forked from EasyRPG/easyrpg.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules
72 lines (62 loc) · 1.54 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
require 'ruby-xxhash'
preprocess do
hide_items_from_sitemap
end
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
compile '/{css/*.scss,js/*.js}' do
ext = "." + item.identifier.ext
if ext == '.scss'
filter :sass, {
:syntax => :scss,
:style => (@config[:prod] ? :compressed : :compact)
}
ext = ".css"
end
# compress and use a hash to avoid caching issues
if @config[:prod]
filter :yui_compressor, :type => :js if ext == ".js"
checksum = XXhash.xxh32(File.read(item[:filename]), 0xEA51)
write item.identifier.without_ext + '-' + checksum.to_s + ".min" + ext
else
write item.identifier.without_ext + ext
end
end
ignore '/css/**/*'
compile '/sitemap.xml' do
filter :erb
write '/sitemap.xml'
end
compile '/htaccess.txt' do
write '/.htaccess'
end
route '/**/*.{html,md}' do
# homepage
if item.identifier =~ '/index.*'
'/index.html'
# error page
elsif item.identifier =~ '/404.*'
'/404.html'
# section home
elsif item.identifier =~ '**/index.*'
item.identifier.without_ext + ".html"
# every other page
else
item.identifier.without_ext + '/index.html'
end
end
passthrough '/**/*'
layout '/**/*.slim', :slim, {
pretty: (@config[:prod] ? false : true),
sort_attrs: false
}
layout '/**/*.html', :erb