Created
March 9, 2011 19:07
-
-
Save ernie/862756 to your computer and use it in GitHub Desktop.
Rake task for minifying javascripts using YUI Compressor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :javascripts do | |
desc 'minify the javascript files residing in app/javascripts to public/javascripts' | |
task :minify do | |
RakeFileUtils.verbose false do | |
Dir["app/javascripts/*.js"].each do |filename| | |
outfile = filename.sub(/^app/, 'public').sub(/\.js$/, '.min.js') | |
puts "#{filename} -> #{outfile}" | |
sh( | |
'java', | |
'-jar', | |
'vendor/yuicompressor/yuicompressor-2.4.2.jar', | |
filename, | |
'-o', | |
outfile | |
) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment