class Sprockets::YUICompressor
Sprockets::YUICompressor.new(munge: true)
environment.register_bundle_processor ‘application/javascript’,
Or to pass options to the YUI::JavaScriptCompressor class.
Sprockets::YUICompressor
environment.register_bundle_processor ‘application/javascript’,
To accept the default options
Public: YUI compressor.
def self.call(*args)
def self.call(*args) new.call(*args) end
def call(input)
def call(input) data = input[:data] case input[:content_type] when 'application/javascript' key = @cache_key + [input[:content_type], input[:data]] input[:cache].fetch(key) do ::YUI::JavaScriptCompressor.new(@options).compress(data) end when 'text/css' key = @cache_key + [input[:content_type], input[:data]] input[:cache].fetch(key) do ::YUI::CssCompressor.new(@options).compress(data) end else data end end
def initialize(options = {})
def initialize(options = {}) @options = options @cache_key = [ 'YUICompressor', ::YUI::Compressor::VERSION, VERSION, options ] end