zeus.ugent.be/Rules
2017-03-15 18:32:36 +01:00

150 lines
1.9 KiB
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'icalendar'
#
#
# PREPROCESS
#
#
preprocess do
`npm install`
# We don't want to compile old blogposts in development
ignore_old_blogposts if development?
update_blog_attributes
create_blog_items
convert_event_time_to_timestamps
end
#
#
# COMPILATION
#
#
compile '/feed.xml' do
filter :erb
end
#
# ARCHIVES
#
compile '/blog/*' do
layout '/archive_page.*'
layout '/generic.*'
layout '/default.*'
filter :erb
end
#
# EVENTS
#
compile '/events/**/*' do
filter :kramdown
layout '/eventpost.*'
layout '/default.*'
filter :erb
end
compile '/events/**/*', rep: :text do
filter :kramdown
filter :strip_html
end
compile '/events/**/*', rep: :ical do
filter :ical
write ext: 'ics'
end
#
# POSTS
#
compile '/blog/*/*' do
layout '/blogpost.md'
filter :kramdown
layout '/blogpost.erb'
layout '/generic.*'
layout '/default.*'
filter :erb
end
compile '/blog/*/*', rep: :text do
filter :kramdown
filter :strip_html
end
#
# PROJECTS
#
compile '/projects/*' do
filter :kramdown
end
# Don't create specific project pages for now
route '/projects/*' do; end
#
# GENERIC ERB PAGES
#
compile '/*_search.json' do
filter :erb
end
compile '/**/*.ics' do
filter :erb
end
compile '/**/*.erb' do
layout '/generic.*'
layout '/default.*'
filter :erb
end
#
# ASSETS
#
compile '/assets/scripts/**/*.coffee' do
filter :coffeescript
write ext: 'js'
end
ignore '/assets/stylesheets/includes/**/*'
compile '/assets/stylesheets/**/*.scss' do
filter :sass, syntax: :scss
filter :autoprefixer if production?
write ext: 'css'
end
#
#
# ROUTES
#
#
#
# ASSETS
#
# EVENTS
route '/**/index.{erb,html,md}' do
"#{item.identifier.without_ext}.html"
end
route '/**/*.{erb,html,md}' do
"#{item.identifier.without_ext}/index.html"
end
# Let anything else simply pass through
passthrough '/**/*'
#
#
# LAYOUTS
#
#
layout '/**/*', :erb