ro.isdc.wro.extensions.processor.support.uglify
Class UglifyJs

java.lang.Object
  extended by ro.isdc.wro.extensions.processor.support.uglify.UglifyJs

public class UglifyJs
extends Object

The underlying implementation use the uglifyJs untagged version: 1.2.6-SNAPSHOT (commited at 2012-02-16 21:30:46)

https://github.com/mishoo/UglifyJS.

The uglify script is resulted from merging of the following two scripts: parse-js.js, process.js. The final version is compressed with packerJs by Dean Edwards.

Since:
1.3.1
Author:
Alex Objelean

Field Summary
static String DEFAULT_UGLIFY_JS
          The name of the uglify script to be used by default.
 
Constructor Summary
UglifyJs(boolean uglify)
           
 
Method Summary
static UglifyJs beautifyJs()
          Factory method for creating the beautifyJs engine.
protected  InputStream getScriptAsStream()
           
 String process(String filename, String code)
           
 UglifyJs setReservedNames(String reservedNames)
          some libraries rely on certain names to be used, so this option allow you to exclude such names from the mangler.
static UglifyJs uglifyJs()
          Factory method for creating the uglifyJs engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_UGLIFY_JS

public static final String DEFAULT_UGLIFY_JS
The name of the uglify script to be used by default.

See Also:
Constant Field Values
Constructor Detail

UglifyJs

public UglifyJs(boolean uglify)
Parameters:
uglify - if true the code will be uglified (compressed and minimized), otherwise it will be beautified (nice formatted).
Method Detail

uglifyJs

public static UglifyJs uglifyJs()
Factory method for creating the uglifyJs engine.


beautifyJs

public static UglifyJs beautifyJs()
Factory method for creating the beautifyJs engine.


setReservedNames

public UglifyJs setReservedNames(String reservedNames)
some libraries rely on certain names to be used, so this option allow you to exclude such names from the mangler. For example, to keep names require and $super intact you'd specify –reserved-names "require,$super".

Parameters:
reservedNames - the reservedNames to set

getScriptAsStream

protected InputStream getScriptAsStream()
Returns:
the stream of the uglify script. Override this method to provide a different script version.

process

public String process(String filename,
                      String code)
               throws IOException
Parameters:
data - js content to process.
Returns:
packed js content.
Throws:
IOException


Copyright © 2008-2012. All Rights Reserved.