-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRakefile
39 lines (34 loc) · 1.05 KB
/
Rakefile
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
require 'uglifier'
task default: %w[build]
task :build_mla do
puts "browserifying"
puts system("browserify -t coffeeify browser.app.coffee > js/markdowntomla.js")
puts "building minified self-contained index.html"
html = File.read('template.html')
bundled = html.split("\n").map{|line|
if line =~ /\<script.*src=\"(.*)\"/
path = $1
js = Uglifier.compile(File.read(path))
"<script type='text/javascript'>#{js}</script>"
else
line
end
}
File.open('built/index.html', 'w'){|f| f.puts bundled}
end
task :build_apa do
puts "browserifying"
puts system("browserify -t coffeeify browser.markdowntoapa.coffee > js/markdowntoapa.js")
puts "building minified self-contained index.html"
html = File.read('template_markdowntoapa.html')
bundled = html.split("\n").map{|line|
if line =~ /\<script.*src=\"(.*)\"/
path = $1
js = Uglifier.compile(File.read(path))
"<script type='text/javascript'>#{js}</script>"
else
line
end
}
File.open('built/apa/index.html', 'w'){|f| f.puts bundled}
end