UglifyJS 2
==========
[![Build Status](https://travis-ci.org/mishoo/UglifyJS2.svg)](https://travis-ci.org/mishoo/UglifyJS2)
UglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit.
This page documents the command line utility. For
[API and internals documentation see my website](http://lisperator.net/uglifyjs/).
There's also an
[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox,
Chrome and probably Safari).
#### Note:
- `uglify-js` only supports ECMAScript 5 (ES5).
- Support for `const` is [present but incomplete](#support-for-const), and may not be
transformed properly.
- Those wishing to minify ES2015+ (ES6+) should use the `npm` package [**uglify-es**](https://github.com/mishoo/UglifyJS2/tree/harmony).
Install
-------
First make sure you have installed the latest version of [node.js](http://nodejs.org/)
(You may need to restart your computer after this step).
From NPM for use as a command line app:
npm install uglify-js -g
From NPM for programmatic use:
npm install uglify-js
Usage
-----
uglifyjs [input files] [options]
UglifyJS2 can take multiple input files. It's recommended that you pass the
input files first, then pass the options. UglifyJS will parse input files
in sequence and apply any compression options. The files are parsed in the
same global scope, that is, a reference from a file to some
variable/function declared in another file will be matched properly.
If you want to read from STDIN instead, pass a single dash instead of input
files.
If you wish to pass your options before the input files, separate the two with
a double dash to prevent input files being used as option arguments:
uglifyjs --compress --mangle -- input.js
The available options are:
```
--source-map Specify an output file where to generate source
map.
--source-map-root The path to the original source to be included
in the source map.
--source-map-url The path to the source map to be added in //#
sourceMappingURL. Defaults to the value passed
with --source-map.
--source-map-include-sources Pass this flag if you want to include the
content of source files in the source map as
sourcesContent property.
--source-map-inline Write base64-encoded source map to the end of js output.
--in-source-map Input source map, useful if you're compressing
JS that was generated from some other original
code. Specify "inline" if the source map is included
inline with the sources.
--screw-ie8 Use this flag if you don't wish to support
Internet Explorer 6/7/8.
By default UglifyJS will not try to be IE-proof.
--support-ie8 Use this flag to support Internet Explorer 6/7/8.
Equivalent to setting `screw_ie8: false` in `minify()`
for `compress`, `mangle` and `output` options.
--expr Parse a single expression, rather than a
program (for parsing JSON)
-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.
-o, --output Output file (default STDOUT).
-b, --beautify Beautify output/specify output options.
-m, --mangle Mangle names/pass mangler options.
-r, --reserved Reserved names to exclude from mangling.
-c, --compress Enable compressor/pass compressor options, e.g.
`-c 'if_return=false,pure_funcs=["Math.pow","console.log"]'`
Use `-c` with no argument to enable default compression
options.
-d, --define Global definitions
-e, --enclose Embed everything in a big function, with a
configurable parameter/argument list.
--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.
--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.
--acorn Use Acorn for parsing.
--spidermonkey Assume input files are SpiderMonkey AST format
(as JSON).
--self Build itself (UglifyJS2) as a library (implies
--wrap=UglifyJS --export-all)
--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.
--export-all Only used when --wrap, this tells UglifyJS to
add code to automatically export all globals.
--lint Display some scope warnings
-v, --verbose Verbose
-V, --version Print version number and exit.
--noerr Don't throw an error for unknown options in -c,
-b or -m.
--bare-returns Allow return outside of functions. Useful when
minifying CommonJS modules and Userscripts that
may be anonymous function wrapped (IIFE) by the
.user.js engine `caller`.
--keep-fnames Do not mangle/drop function names. Useful for
code relying on Function.prototype.name.
--reserved-file File containing reserved names
--reserve-domprops Make (most?) DOM properties reserved for
--mangle-props
--mangle-props Mangle property names (default `0`). Set to
`true` or `1` to mangle all property names. Set
to `unquoted` or `2` to onl
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件开发设计:应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
使用vue2+node.js+mysql+three.js的前后端分离项目.zip (2000个子文件)
moment-with-locales.js 603KB
locales.js 434KB
moment-with-locales.min.js 361KB
locales.min.js 303KB
moment.js 170KB
moment.js 150KB
wkx.js 139KB
acorn_csp.js 132KB
acorn.js 130KB
model.js 106KB
query-generator.js 84KB
lodash.min.js 71KB
wkx.min.js 64KB
moment.min.js 57KB
acorn_loose.js 41KB
source-map-consumer.js 39KB
long.js 38KB
sbcs-data-generated.js 31KB
query-generator.js 31KB
query-generator.js 31KB
query-generator.js 27KB
response.js 26KB
expression.js 24KB
query-interface.js 24KB
index.js 24KB
belongs-to-many.js 23KB
tokenize.js 22KB
index.js 22KB
dbcs-codec.js 21KB
sequelize.js 21KB
statement.js 20KB
query-generator.js 19KB
ipaddr.js 19KB
query.js 19KB
data-types.js 17KB
query-generator.js 16KB
query.js 16KB
_baseConvert.js 16KB
expression.js 15KB
tests.js 15KB
query-generator.js 15KB
index.js 15KB
simple.js 14KB
source-node.js 14KB
application.js 14KB
source-map-generator.js 14KB
range.js 14KB
index.js 14KB
statement.js 14KB
utils.js 13KB
data-types.js 13KB
index.js 13KB
day-of-week.js 13KB
identifier.js 13KB
query.js 12KB
query.js 12KB
request.js 12KB
query.js 12KB
has-many.js 12KB
inliner.js 12KB
geometry.js 12KB
walk.js 12KB
restructure.js 11KB
index.js 11KB
override-compactor.js 11KB
toposort.js 11KB
break-up.js 11KB
index.js 10KB
parse.js 10KB
template.js 10KB
util.js 10KB
month.js 10KB
_mapping.js 10KB
amdefine.js 10KB
index.js 10KB
long.js 10KB
ipaddr.min.js 10KB
connection-manager.js 9KB
query.js 9KB
ru.js 9KB
utf7.js 9KB
cliui.js 9KB
input-source-map-tracker.js 9KB
query.js 9KB
tokenize.js 9KB
instance-validator.js 9KB
extend-node.js 8KB
query-interface.js 8KB
optimizer.js 8KB
connection-manager.js 8KB
data-types.js 8KB
yallist.js 8KB
query.js 8KB
ru.js 8KB
ru.js 8KB
dbcs-data.js 8KB
polygon.js 8KB
seq-queue-test.js 8KB
index.js 8KB
semver.js 8KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 20240429_112025.m4a
- 91fdd461elb59a4ce8dfcfc46bc283a7.msi
- Image_1715565894150.jpg
- 计算机网络.docx
- Oracle Instant Client for Linux x86-64 (64-bit) Version 11.1.0.7
- dataExpr.tom-block.1.RData
- 实战验证过的最新远程Tomcat调试方式(基于IDEA2023/2024, JDK1.8, TOMCAT9, WIN10的)
- 200SMART与V20变频器RTU通讯.smart
- 天使插件4.019版-成品
- weinxin小程序仿ofo共享单车
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功