-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.rb
47 lines (31 loc) · 840 Bytes
/
config.rb
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
activate :autoprefixer
helpers do
def remark
Dir.glob('source/remarks/*.remark')[0]
end
def remark_link(file)
filename = File.basename(file, '.remark')
title = filename.gsub("_", " ").titleize
url = "/remarks/#{filename}.remark"
link_to title, url
end
def extract_content(name)
file = File.read(name)
file.sub(stylesheet_regex, '')
end
def extract_stylesheet(name)
file = File.read(name)
stylesheet_regex.match(file) { |m| m[1] } || 'default'
end
def stylesheet_regex
/\A!!! (\S*)$/
end
end
r = remark()
stylesheet = extract_stylesheet(r)
proxy "/index.html", "/template.html", :layout => "index", :locals => { :remark => r, :stylesheet => stylesheet }
set :fonts_dir, 'source/fonts/'
ignore "/template.html"
configure :development do
activate :livereload
end