zeus.ugent.be/Rules
Lorin Werthen 70e8779c81
what
2016-12-29 13:43:31 +01:00

162 lines
2.1 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
write '/feed.xml'
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
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
end
ignore '/assets/stylesheets/includes/**/*'
compile '/assets/stylesheets/**/*.scss' do
filter :sass, syntax: :scss
filter :autoprefixer if production?
end
#
#
# ROUTES
#
#
#
# ASSETS
#
route '/assets/stylesheets/**/*' do
"#{item.identifier.without_ext}.css"
end
route '/assets/scripts/**/*' do
"#{item.identifier.without_ext}.js"
end
# EVENTS
route '/events/**/*', rep: :ical do
"#{item.identifier.without_ext}.ics"
end
route '/**/*.{erb,html,md}' do
if item.identifier.without_ext.to_s =~ %r{/index$}
"#{item.identifier.without_ext}.html"
else
"#{item.identifier.without_ext}/index.html"
end
end
# Let anything else simply pass through
passthrough '/**/*'
#
#
# LAYOUTS
#
#
layout '/**/*', :erb