Class Uglifier
In: lib/uglifier.rb
Parent: Object

Methods

compile   compile   compress   new  

Constants

Error = ExecJS::Error
DEFAULTS = { :mangle => true, # Mangle variable and function names, use :vars to skip function mangling :toplevel => false, # Mangle top-level variable names :except => ["$super"], # Variable names to be excluded from mangling :max_line_length => 32 * 1024, # Maximum line length :squeeze => true, # Squeeze code resulting in smaller, but less-readable code :seqs => true, # Reduce consecutive statements in blocks into single statement :dead_code => true, # Remove dead code (e.g. after return) :lift_vars => false, # Lift all var declarations at the start of the scope :unsafe => false, # Optimizations known to be unsafe in some situations :copyright => true, # Show copyright message :ascii_only => false, # Encode non-ASCII characters as Unicode code points :inline_script => false, # Escape </script :quote_keys => false, # Quote keys in object literals :define => {}, # Define values for symbol replacement :beautify => false, # Ouput indented code :beautify_options => { :indent_level => 4, :indent_start => 0, :space_colon => false   Default options for compilation
SourcePath = File.expand_path("../uglify.js", __FILE__)
ES5FallbackPath = File.expand_path("../es5.js", __FILE__)

Public Class methods

Minifies JavaScript code using implicit context.

source should be a String or IO object containing valid JavaScript. options contain optional overrides to Uglifier::DEFAULTS

Returns minified code as String

Initialize new context for Uglifier with given options

options - Hash of options to override Uglifier::DEFAULTS

Public Instance methods

Minifies JavaScript code

source should be a String or IO object containing valid JavaScript.

Returns minified code as String

compress(source)

Alias for compile

[Validate]