public class UglifyJs extends Object
https://github.com/mishoo/UglifyJS.
The uglify script is resulted from merging of the following two scripts: parse-js.js, process.js.| Modifier and Type | Class and Description |
|---|---|
static class |
UglifyJs.Type
The type of processing supported by UglifyJs library.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_UGLIFY_JS
The name of the uglify script to be used by default.
|
| Constructor and Description |
|---|
UglifyJs(UglifyJs.Type uglifyType) |
| Modifier and Type | Method and Description |
|---|---|
static UglifyJs |
beautifyJs()
Factory method for creating the beautifyJs engine.
|
protected String |
createOptionsAsJson()
Reads by default options from options.js file located in the same package.
|
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.
|
public static final String DEFAULT_UGLIFY_JS
public UglifyJs(UglifyJs.Type uglifyType)
uglify - if true the code will be uglified (compressed and minimized), otherwise it will be beautified (nice
formatted).public static UglifyJs uglifyJs()
public static UglifyJs beautifyJs()
public UglifyJs setReservedNames(String reservedNames)
reservedNames - the reservedNames to setprotected InputStream getScriptAsStream()
public String process(String filename, String code) throws IOException
data - js content to process.IOExceptionprotected String createOptionsAsJson() throws IOException
{
codegen_options: {
beautify: false,
space_colon: false
},
squeeze: true,
dead_code: true,
mangle: true
}
IOExceptionCopyright © 2008-2013. All Rights Reserved.