Class: YUI::JavaScriptCompressor
- Inherits:
-
Compressor
- Object
- Compressor
- YUI::JavaScriptCompressor
- Defined in:
- lib/yui/compressor.rb
Constant Summary
Constants inherited from Compressor
Compressor::VERSION, Compressor::YUI_ERROR_MARKER
Instance Attribute Summary
Attributes inherited from Compressor
Class Method Summary collapse
-
.compressor_type ⇒ Object
:nodoc:.
-
.default_options ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ JavaScriptCompressor
constructor
Creates a new YUI::JavaScriptCompressor for minifying JavaScript code.
Methods inherited from Compressor
Constructor Details
#initialize(options = {}) ⇒ JavaScriptCompressor
Creates a new YUI::JavaScriptCompressor for minifying JavaScript code.
Options are:
:charset
-
Specifies the character encoding to use. Defaults to
"utf-8"
. :line_break
-
By default, JavaScript will be compressed onto a single line. Use this option to specify the maximum number of characters in each line before a newline is added. If
:line_break
is 0, a newline is added after each JavaScript statement. :munge
-
Specifies whether YUI Compressor should shorten local variable names when possible. Defaults to
false
. :optimize
-
Specifies whether YUI Compressor should optimize JavaScript object property access and object literal declarations to use as few characters as possible. Defaults to
true
. :preserve_semicolons
-
Defaults to
false
. Iftrue
, YUI Compressor will ensure semicolons exist after each statement to appease tools like JSLint.
190 191 192 |
# File 'lib/yui/compressor.rb', line 190 def initialize( = {}) super end |
Class Method Details
.compressor_type ⇒ Object
:nodoc:
156 157 158 |
# File 'lib/yui/compressor.rb', line 156 def self.compressor_type #:nodoc: "js" end |
.default_options ⇒ Object
:nodoc:
160 161 162 163 164 165 166 |
# File 'lib/yui/compressor.rb', line 160 def self. #:nodoc: super.merge( :munge => false, :optimize => true, :preserve_semicolons => false ) end |