lib/jammit/compressor.rb in jammit-0.3.2 vs lib/jammit/compressor.rb in jammit-0.3.3
- old
+ new
@@ -43,28 +43,28 @@
# Creating a compressor initializes the internal YUI Compressor from
# the "yui-compressor" gem, or the internal Closure Compiler from the
# "closure-compiler" gem.
def initialize
- @css_compressor = YUI::CssCompressor.new
+ @css_compressor = YUI::CssCompressor.new(Jammit.css_compressor_options)
flavor = Jammit.javascript_compressor
@options = DEFAULT_OPTIONS[flavor].merge(Jammit.compressor_options)
@js_compressor = COMPRESSORS[flavor].new(@options)
end
# Concatenate together a list of JavaScript paths, and pass them through the
# YUI Compressor (with munging enabled).
def compress_js(paths)
js = concatenate(paths)
- @options[:disabled] ? js : @js_compressor.compress(js)
+ Jammit.compress_assets ? @js_compressor.compress(js) : js
end
# Concatenate and compress a list of CSS stylesheets. When compressing a
# :datauri or :mhtml variant, post-processes the result to embed
# referenced images.
def compress_css(paths, variant=nil, asset_url=nil)
css = concatenate_and_tag_images(paths, variant)
- css = @css_compressor.compress(css) unless @options[:disabled]
+ css = @css_compressor.compress(css) if Jammit.compress_assets
case variant
when nil then return css
when :datauri then return with_data_uris(css)
when :mhtml then return with_mhtml(css, asset_url)
else raise PackageNotFound, "\"#{variant}\" is not a valid stylesheet variant"