2015-04-06 23:27:29 -04:00
|
|
|
require 'uglifier'
|
|
|
|
|
|
|
|
task default: %w[build]
|
|
|
|
|
2015-04-07 04:49:22 -04:00
|
|
|
task :build_mla do
|
2015-04-07 02:31:02 -04:00
|
|
|
puts "browserifying"
|
|
|
|
puts system("browserify -t coffeeify browser.app.coffee > js/markdowntomla.js")
|
|
|
|
|
|
|
|
puts "building minified self-contained index.html"
|
2015-04-07 02:42:30 -04:00
|
|
|
html = File.read('template.html')
|
2015-04-06 23:27:29 -04:00
|
|
|
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
|
|
|
|
}
|
2015-04-07 02:31:02 -04:00
|
|
|
File.open('built/index.html', 'w'){|f| f.puts bundled}
|
2015-04-07 04:49:22 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
task :build_apa do
|
|
|
|
puts "browserifying"
|
|
|
|
puts system("browserify -t coffeeify browser.markdowntoapa.coffee > js/markdowntoapa.js")
|
|
|
|
|
2015-07-20 14:57:08 -04:00
|
|
|
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}
|
2015-04-06 23:27:29 -04:00
|
|
|
end
|