Permalink
Browse files

adding minification as an option.

add :minify => true to set a minifier.
  • Loading branch information...
1 parent df9ddad commit c5f84d4f0ef21c8a1688dab251be527d51a10cc1 Dotan J. Nahum committed Feb 13, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/guard/sprockets.rb
View
@@ -17,6 +17,16 @@ def initialize(watchers=[], options={})
@asset_paths.each do |p|
@sprockets_env.append_path p
end
+
+ if options.delete(:minify)
+ begin
+ require 'uglifier'
+ @sprockets_env.js_compressor = ::Uglifier.new
+ UI.info "Sprockets will compress output (minify)."
+ rescue
+ UI.error "minify: Uglifier cannot be loaded. No compression will be used.\nPlease include 'uglifier' in your Gemfile.\n#{$!}"
+ end
+ end
# store the output destination
@destination = options.delete(:destination)
@opts = options

0 comments on commit c5f84d4

Please sign in to comment.