Skip to content

Instantly share code, notes, and snippets.

@hawx
Created July 4, 2010 15:41
Show Gist options
  • Save hawx/463532 to your computer and use it in GitHub Desktop.
Save hawx/463532 to your computer and use it in GitHub Desktop.
Minify a folder of js with `rake minify`
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