Skip to content

Instantly share code, notes, and snippets.

@dburger
Created November 23, 2008 21:22
Show Gist options
  • Save dburger/28207 to your computer and use it in GitHub Desktop.
Save dburger/28207 to your computer and use it in GitHub Desktop.
namespace :minifier do
def minify(files)
files.each do |file|
cmd = "java -jar lib/yuicompressor-2.3.1.jar #{file} -o #{file}"
puts cmd
ret = system(cmd)
raise "Minification failed for #{file}" if !ret
end
end
desc "minify"
task :minify => [:minify_js, :minify_css]
desc "minify javascript"
task :minify_js do
minify(FileList['public/javascripts/**/*.js'])
end
desc "minify css"
task :minify_css do
minify(FileList['public/stylesheets/**/*.css'])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment