Scroll to navigation

UGLIFY-JS(1) User Commands UGLIFY-JS(1)

NAME

uglify-js - manual page for uglify-js 2.7.5

DESCRIPTION

/usr/bin/nodejs bin/uglifyjs input1.js [input2.js ...] [options] Use a single dash to read input from the standard input.

NOTE: by default there is no mangling/compression. Without [options] it will simply parse input files and dump the AST with whitespace and comments discarded. To achieve compression and mangling you need to use `-c` and `-m`.

OPTIONS

--source-map
Specify an output file where to generate source map. This parameter is a string.
--source-map-root
The path to the original source to be included in the source map. This parameter is a string.
--source-map-url
The path to the source map to be added in //# sourceMappingURL. Defaults to the value passed with --source-map. This parameter is a string.
--source-map-inline
Write base64-encoded source map to the end of js output. Disabled by default This parameter is a boolean.
--source-map-include-sources
Pass this flag if you want to include the content of source files in the source map as sourcesContent property. This parameter is a boolean.
--in-source-map
Input source map, useful if you're compressing JS that was generated from some other original code.
--screw-ie8
Do not support Internet Explorer 6-8 quirks. This flag is enabled by default. This parameter is a boolean.
--support-ie8
Support non-standard Internet Explorer 6-8 javascript. Note: may break standards compliant `catch` identifiers. This parameter is a boolean.
--expr
Parse a single expression, rather than a program (for parsing JSON) This parameter is a boolean.
-p, --prefix
Skip prefix for original filenames that appear in source maps. For example -p 3 will drop 3 directories from file names and ensure they are relative paths. You can also specify -p relative, which will make UglifyJS figure out itself the relative paths between original sources, the source map and the output file.
This parameter is a string.
-o, --output
Output file (default STDOUT).
-b, --beautify
Beautify output/specify output options. This parameter is a string.
-m, --mangle
Mangle names/pass mangler options. This parameter is a string.
-r, --reserved
Reserved names to exclude from mangling.
-c, --compress
Enable compressor/pass compressor options. Pass options like -c hoist_vars=false,if_return=false. Use -c with no argument to use the default compression options.
This parameter is a string.
-d, --define
Global definitions This parameter is a string.
-e, --enclose
Embed everything in a big function, with a configurable parameter/argument list. This parameter is a string.
--comments
Preserve copyright comments in the output. By default this works like Google Closure, keeping JSDoc-style comments that contain "@license" or "@preserve". You can optionally pass one of the following arguments to this flag: - "all" to keep all comments - a valid JS RegExp like `/foo/`or `/^!/` to keep only matching comments. Note that currently not *all* comments can be kept when compression is on, because of dead code removal or cascading statements into sequences. This parameter is a string.
--preamble
Preamble to prepend to the output. You can use this to insert a comment, for example for licensing information. This will not be parsed, but the source map will adjust for its presence.
--stats
Display operations run time on STDERR. This parameter is a boolean.
--acorn
Use Acorn for parsing. This parameter is a boolean.
--spidermonkey
Assume input files are SpiderMonkey AST format (as JSON). This parameter is a boolean.
--self
Build itself (UglifyJS2) as a library (implies --wrap=UglifyJS --export-all) This parameter is a boolean.
--wrap
Embed everything in a big function, making the ???exports??? and ???global??? variables available. You need to pass an argument to this option to specify the name that your module will take when included in, say, a browser. This parameter is a string.
--export-all
Only used when --wrap, this tells UglifyJS to add code to automatically export all globals.
This parameter is a boolean.
--lint
Display some scope warnings This parameter is a boolean.
-v, --verbose
Verbose This parameter is a boolean.
-V, --version
Print version number and exit. This parameter is a boolean.
--noerr
Don't throw an error for unknown options in -c, -b or -m. This parameter is a boolean.
--bare-returns
Allow return outside of functions. Useful when minifying CommonJS modules. This parameter is a boolean.
--keep-fnames
Do not mangle/drop function names. Useful for code relying on Function.prototype.name.
This parameter is a boolean.
--reserved-file
File containing reserved names This parameter is an array.
--reserve-domprops
Make (most?) DOM properties reserved for --mangle-props This parameter is a boolean.
--mangle-props
Mangle property names (0 - disabled, 1 - mangle all properties, 2 - mangle unquoted properies)
--mangle-regex
Only mangle property names matching the regex
--name-cache
File to hold mangled names mappings This parameter is a string.
--pure-funcs
List of functions that can be safely removed if their return value is not used This parameter is an array.
--dump-spidermonkey-ast
Dump SpiderMonkey AST to stdout. This parameter is a boolean.
--wrap-iife
Wrap IIFEs in parenthesis. Note: this disables the negate_iife compression option This parameter is a boolean.
--help
Show help This parameter is a boolean.
-q, --quotes
Quote style (0 - auto, 1 - single, 2 - double, 3 - original)
February 2018 uglify-js 2.7.5