-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rules
45 lines (37 loc) · 831 Bytes
/
Rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env ruby
compile '/static/*/' do
# don’t filter or layout
end
compile '*' do
if item.binary?
# don’t filter binary items
else
item[:extension].split(".").reverse.each do |ext|
case ext
when /(^|\.)md$/
filter :kramdown
when /(^|\.)haml$/
filter :haml
when /(^|\.)erb$/
filter :erb
end
end
layout item[:layout] || "default"
end
end
route '/static/img/*/' do
item.identifier.chop + '.' + item[:extension]
end
route '/static/css/*/' do
item.identifier.chop + '.css'
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