175 lines
2.3 KiB
Ruby
175 lines
2.3 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_yearly_items('Blog')
|
|
create_yearly_items('Events')
|
|
convert_event_time_to_timestamps
|
|
end
|
|
|
|
#
|
|
#
|
|
# COMPILATION
|
|
#
|
|
#
|
|
compile '/*.xml' do
|
|
filter :erb
|
|
end
|
|
|
|
#
|
|
# ARCHIVES
|
|
#
|
|
compile '/blog/*' do
|
|
layout '/archive_page.*'
|
|
layout '/generic.*'
|
|
layout '/default.*'
|
|
filter :erb
|
|
end
|
|
|
|
#
|
|
# EVENTS
|
|
#
|
|
|
|
# Overview page
|
|
compile '/events/*' do
|
|
layout '/events.*'
|
|
layout '/generic.*'
|
|
layout '/default.*'
|
|
filter :erb
|
|
end
|
|
|
|
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
|
|
|
|
compile '/*_search.json' do
|
|
filter :erb
|
|
end
|
|
|
|
compile '/**/*.ics' do
|
|
filter :erb
|
|
end
|
|
|
|
#
|
|
# GENERIC ERB PAGES
|
|
#
|
|
compile '/**/*.erb' do
|
|
filter :erb
|
|
|
|
layout '/generic.*'
|
|
layout '/default.*'
|
|
end
|
|
|
|
compile '/**/*.md' do
|
|
filter :erb
|
|
filter :kramdown
|
|
|
|
layout '/generic.*'
|
|
layout '/default.*'
|
|
end
|
|
|
|
#
|
|
# ASSETS
|
|
#
|
|
compile '/assets/scripts/**/*.coffee' do
|
|
filter :coffeescript
|
|
filter :uglify_js
|
|
write ext: 'js'
|
|
end
|
|
|
|
compile '/assets/scripts/**/*.js' do
|
|
filter :uglify_js
|
|
end
|
|
|
|
ignore '/assets/stylesheets/includes/**/*'
|
|
ignore '/data/**/*'
|
|
|
|
compile '/assets/stylesheets/**/*.scss' do
|
|
filter :sass, syntax: :scss, style: :compressed
|
|
filter :autoprefixer if production?
|
|
write ext: 'css'
|
|
end
|
|
|
|
#
|
|
#
|
|
# ROUTES
|
|
#
|
|
#
|
|
|
|
# Google verification file
|
|
passthrough '/google6f2e77d0228abc35.html'
|
|
|
|
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
|