class Sprockets::UglifierCompressor
Sprockets::UglifierCompressor.new(comments: :copyright)
environment.register_bundle_processor ‘application/javascript’,
Or to pass options to the Uglifier class.
Sprockets::UglifierCompressor
environment.register_bundle_processor ‘application/javascript’,
To accept the default options
Public: Uglifier/Uglify 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) @uglifier.compile(input[:data]) end
def initialize(options = {})
def initialize(options = {}) # Feature detect Uglifier 2.0 option support if Autoload::Uglifier::DEFAULTS[:copyright] # Uglifier < 2.x options[:copyright] ||= false else # Uglifier >= 2.x options[:copyright] ||= :none end @uglifier = Autoload::Uglifier.new(options) @cache_key = "#{self.class.name}:#{Autoload::Uglifier::VERSION}:#{VERSION}:#{DigestUtils.digest(options)}".freeze end