Created
July 4, 2010 15:41
-
-
Save hawx/463532 to your computer and use it in GitHub Desktop.
Minify a folder of js with `rake minify`
This file contains hidden or 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
desc "minify js and put into one file" | |
task :minify do | |
require 'jsmin' | |
out = 'min.js' | |
glb = '*.js' | |
res = '' | |
Dir[glb].each do |path| | |
res << File.read(path) << "\n" | |
end | |
res = JSMin.minify(res) | |
File.open(out, 'w') {|f| f.write(res) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment