-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRules
More file actions
107 lines (85 loc) · 2.04 KB
/
Copy pathRules
File metadata and controls
107 lines (85 loc) · 2.04 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# A few helpful tips about the Rules file:
#
# * The order of rules is important: for each item, only the first matching
# rule is applied.
#
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
# “content/about.html”). To select all children, grandchildren, … of an
# item, use the pattern “/about/*/”; “/about/*” will also select the parent,
# because “*” matches zero or more characters.
require 'compass'
Compass.add_project_configuration 'compass/config.rb' # when using Compass 0.10
preprocess do
# authors may unpublish items by setting meta attribute publish: false
items.delete_if { |item| item[:publish] == false }
end
compile '/blog/*/' do
unless item.binary?
filter :kramdown
filter :colorize_syntax, :coderay => {:line_numbers => nil, :wrap => nil, :tab_width => 4} #
layout 'article'
layout 'default'
end
end
compile '/tags/*' do
unless item.binary?
filter :erb
layout 'default'
end
end
compile '/assets/css/_*/' do
# don't output partials, so return nil
nil
end
compile '/assets/css/*/' do
filter :sass, Compass.sass_engine_options
end
compile '/assets/*' do
# don’t filter or layout
end
compile '/portfolio/*/' do
unless item.binary?
filter :kramdown
layout 'portfolio'
layout 'default'
end
end
compile '*' do
if !item.binary?
case item[:extension]
when 'md'
filter :kramdown
when 'erb'
filter :erb
end
layout 'default'
end
end
#### ROUTES ####
route '/js/*' do
item.identifier.chop + ".#{item[:extension]}"
end
route '/404/' do
item.identifier.chop + '.html'
end
route '/assets/css/_*/' do
# don't output partials, so return nil
nil
end
route '/assets/css/*/' do
item.identifier[7..-2] + '.css'
end
route '/assets/*' do
item.identifier[7..-2] + ".#{item[:extension]}"
end
route '*' do
if item.binary?
item.identifier.chop + '.' + item[:extension]
else
item.identifier + 'index.html'
end
end
### LAYOUTS ###
layout '*', :erb