| Package | vegas.strings |
| Class | public class Minifier |
| Inheritance | Minifier Object |
| Implements | Runnable |
import vegas.strings.Minifier ;
var input:String = "var a = 1 ; \r\n var b = 2 ; var c = 3 ; " ;
var minifier:JSMinifier = new JSMinifier( input , JSMinifier.NORMAL ) ;
minifier.run() ;
var output:String = minifier.output ;
trace("old size : " + minifier.oldSize ) ;
trace("new size : " + minifier.newSize ) ;
trace("input : " + minifier.input ) ;
trace("output : " + output ) ;
| Property | Defined By | ||
|---|---|---|---|
| input : String
The input String to minimize. | Minifier | ||
| level : uint
The level of compression of the minifier. | Minifier | ||
| newSize : uint [read-only]
Indicates the new size of the output source. | Minifier | ||
| oldSize : uint [read-only]
Indicates the original size of the input source. | Minifier | ||
| output : String [read-only]
The output result of the minifier process. | Minifier | ||
| Method | Defined By | ||
|---|---|---|---|
Minifier(input:String, level:uint = 2)
Creates a new JSMinifier instance. | Minifier | ||
run(... arguments):void
minify the javascript/ecmascript String input value. | Minifier | ||
| Method | Defined By | ||
|---|---|---|---|
action(d:uint):String
Do something! What you do is determined by the argument:
1 : Output A. | Minifier | ||
| Constant | Defined By | ||
|---|---|---|---|
| AGRESSIVE : uint = 3 [static]
Remove more linefeed than the original algorithm but can be regressive
| Minifier | ||
| MINIMAL : uint = 1 [static]
Original algorithm but keep linefeeds if single. | Minifier | ||
| NORMAL : uint = 2 [static]
Original algorithm (conservative). | Minifier | ||
| input | property |
input:StringThe input String to minimize.
public function get input():String public function set input(value:String):void| level | property |
level:uintThe level of compression of the minifier.
public function get level():uint public function set level(value:uint):void| newSize | property |
newSize:uint [read-only] Indicates the new size of the output source.
public function get newSize():uint| oldSize | property |
oldSize:uint [read-only] Indicates the original size of the input source.
public function get oldSize():uint| output | property |
output:String [read-only] The output result of the minifier process.
public function get output():String| Minifier | () | Constructor |
public function Minifier(input:String, level:uint = 2)Creates a new JSMinifier instance.
Parametersinput:String — The String source to minify.
| |
level:uint (default = 2) — The level of compression :
|
| action | () | method |
protected function action(d:uint):StringDo something! What you do is determined by the argument: 1 : Output A. Copy B to A. Get the next B. 2 : Copy B to A. Get the next B. (Delete A). 3 : Get the next B. (Delete B). action treats a string as a single character. Wow! action recognizes a regular expression if it is preceded by ( or , or =.
Parameters
d:uint |
String |
| run | () | method |
public function run(... arguments):voidminify the javascript/ecmascript String input value.
Parameters
... arguments |
| AGRESSIVE | Constant |
public static const AGRESSIVE:uint = 3Remove more linefeed than the original algorithm but can be regressive
| MINIMAL | Constant |
public static const MINIMAL:uint = 1Original algorithm but keep linefeeds if single.
| NORMAL | Constant |
public static const NORMAL:uint = 2Original algorithm (conservative).