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.cache_key
def self.cache_key instance.cache_key end
def self.call(input)
def self.call(input) instance.call(input) end
def self.instance
Public: Return singleton instance with default options.
def self.instance @instance ||= new end
def call(input)
def call(input) data = input[:data] case input[:content_type] when 'application/javascript' Autoload::YUI::JavaScriptCompressor.new(@options).compress(data) when 'text/css' Autoload::YUI::CssCompressor.new(@options).compress(data) else data end end
def initialize(options = {})
def initialize(options = {}) @options = options @cache_key = "#{self.class.name}:#{Autoload::YUI::Compressor::VERSION}:#{VERSION}:#{DigestUtils.digest(options)}".freeze end