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.call(*args)
def self.call(*args) new.call(*args) end
def call(input)
def call(input) data = input[:data] input[:cache].fetch(@cache_key + [data]) do @uglifier.compile(data) end end
def initialize(options = {})
def initialize(options = {}) # Feature detect Uglifier 2.0 option support if Uglifier::DEFAULTS[:copyright] # Uglifier < 2.x options[:copyright] ||= false else # Uglifier >= 2.x options[:copyright] ||= :none end @uglifier = ::Uglifier.new(options) @cache_key = [ 'UglifierCompressor', ::Uglifier::VERSION, VERSION, options ] end