Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (21 sloc) 0.599 kb
require "tempfile"
require "yui/compressor"
require "fileutils"
APP_PATH = File.expand_path("./public/application.js")
task :build do
`sprocketize -I public/ public/juggernaut.js > #{APP_PATH}`
end
task :compress do
tempfile = Tempfile.new("yui")
compressor = YUI::JavaScriptCompressor.new(:munge => true)
File.open(APP_PATH, "r") do |file|
compressor.compress(file) do |compressed|
while buffer = compressed.read(4096)
tempfile.write(buffer)
end
end
end
tempfile.close
FileUtils.mv(tempfile.path, APP_PATH)
end
task :default => [:build, :compress]
Jump to Line
Something went wrong with that request. Please try again.