devroom.io/Rules
2013-03-22 22:03:45 +01:00

53 lines
1.0 KiB
Ruby

#!/usr/bin/env ruby
SASS_LOAD_PATHS = [
File.join(`bundle show bourbon`.chomp, *%w[app assets stylesheets]),
File.join(`bundle show rocks`.chomp, *%w[app assets stylesheets])
]
compile '/stylesheet/' do
filter :sass, syntax: :scss, load_paths: SASS_LOAD_PATHS
end
compile '/javascript/' do
filter :coffeescript
end
compile '/posts/*' do
filter :kramdown, auto_ids: false, coderay_line_numbers: nil, coderay_tab_width: 2
filter :typogruby
layout 'post'
end
compile '*' do
unless item.binary?
filter :erb
layout 'default'
end
end
route '/stylesheet/' do
'/style.css'
end
route '/javascript/' do
'/script.js'
end
route '/posts/*' do
y, m, d, slug = /([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)/.match(item.identifier).captures
"/#{y}/#{m}/#{d}/#{slug}/index.html"
end
route '*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
end
end
layout '*', :erb