Class UglifyJs
java.lang.Object
ro.isdc.wro.extensions.processor.support.uglify.UglifyJs
The underlying implementation use untagged version (commited on 2012-09-08 14:15:12).
The uglify script is resulted from merging of the following two scripts: parse-js.js, process.js.
- Since:
- 1.3.1
- Author:
- Alex Objelean
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of processing supported by UglifyJs library. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the uglify script to be used by default. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UglifyJsFactory method for creating the beautifyJs engine.protected StringReads by default options from options.js file located in the same package.protected InputStreamsetReservedNames(String reservedNames) some libraries rely on certain names to be used, so this option allow you to exclude such names from the mangler.static UglifyJsuglifyJs()Factory method for creating the uglifyJs engine.
-
Field Details
-
DEFAULT_UGLIFY_JS
The name of the uglify script to be used by default.- See Also:
-
-
Constructor Details
-
UglifyJs
- Parameters:
uglifyType- Depending on the type, the code will either be uglified (compressed and minimized), or it will be beautified (nice formatted).
-
-
Method Details
-
uglifyJs
Factory method for creating the uglifyJs engine. -
beautifyJs
Factory method for creating the beautifyJs engine. -
setReservedNames
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
- Returns:
- the stream of the uglify script. Override this method to provide a different script version.
-
process
- Parameters:
filename- js content to process.- Returns:
- packed js content.
- Throws:
IOException
-
createOptionsAsJson
Reads by default options from options.js file located in the same package. This is an example of how the options could look like:{ codegen_options: { beautify: false, space_colon: false }, squeeze: true, dead_code: true, mangle: true }- Returns:
- json representation of options.
- Throws:
IOException
-