-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rules
72 lines (61 loc) · 1.44 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env ruby
preprocess do
write_sitemap_file
end
# all pages
compile '/**/*.{html,md}' do
filter :erb
filter :kramdown, auto_ids: false if item.identifier =~ '/**/*.md'
filter :colorize_syntax, :default_colorizer => :rouge
layout '/default.*'
# enhance quotes and such
filter :typogruby
# pretty-print, find errors
filter :tidy if @config[:prod]
end
# home and error page
route '/*.{html,md}' do
item.identifier.without_ext + '.html'
end
route '/**/*.{html,md}' do
# section home
if item.identifier =~ '**/index.*'
item.identifier.without_ext + ".html"
# every other page
else
item.identifier.without_ext + '/index.html'
end
end
ignore '/css/{vendor,bits}/*'
compile '/css/*.scss' do
filter :dart_sass, :style => (@config[:prod] ? :compressed : :expanded)
end
compile '/js/*.js' do
if @config[:prod]
filter :terser
end
end
route '/{js/*.js,css/*.scss}' do
ext = item.identifier.ext == 'scss' ? '.css' : '.' + item.identifier.ext
if @config[:prod]
item.identifier.without_ext + '-' + asset_hash(item) + '.min' + ext
else
item.identifier.without_ext + ext
end
end
compile '/sitemap.xml' do
filter :erb
write '/sitemap.xml'
end
# duplicate some files
compile '/ads.txt' do
write item.identifier
write "/app-ads.txt"
end
# copy the rest over
passthrough '/**/*'
layout '/**/*.slim', :slim, {
pretty: (@config[:prod] ? false : true),
sort_attrs: false
}
layout '/**/*.html', :erb