- 时间:2022-07-15 20:21 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Uglifyjs(JS代码优化工具)入门 安装使用
你也可以尝试一下在线版的Uglifyjs: [url=http://sweet.fengyin.name/]http://sweet.fengyin.name/[/url]
需要先安装node,进入命令行,查看node,npm是否正确安装。
[img]http://files.jb51.net/upload/201203/20120307102226683.png[/img]
接下来安装UglifyJS,命令如:npm install uglify-js -g
[img]http://files.jb51.net/upload/201203/20120307102227234.png[/img]
最后别忘了把node和npm添加到环境变量中,我的分别是
C:\Program Files (x86)\nodejs\;
C:\Users\taozhou\AppData\Roaming\npm;
[img]http://files.jb51.net/upload/201203/20120307102227653.png[/img]
现在就可以使用uglifyjs就行压缩了,如
uglifyjs folder/dom.js -> folder/dom-min.js
会把目录folder下dom.js压缩,保存在同一个目录下。
详细参数参考: [url=https://github.com/mishoo/UglifyJS]https://github.com/mishoo/UglifyJS[/url]