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

Returns UglifierCompressor object.

Public: Return singleton instance with default options.
def self.instance
  @instance ||= new
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 = [
    self.class.name,
    ::Uglifier::VERSION,
    VERSION,
    options
  ].freeze
end