在windows机器上如何使用uglify.js


A few days ago, I’ve been looking for a JavaScript minifier and wondered what the jQuery team may be using today. Turned out, they have abandoned Google Closure in favor of UglifyJS – a JavaScript parser/compressor/beautifier created by Mihai Bazon. UglifyJS is written in JavaScript and therefore should run on any JavaScript engine, but its “native” one is node.js, which is only available for Unix-like systems, including Linux, BSD, and Mac, but not for Windows. Or so I thought.

Fact is, Microsoft is now helping port node.js to Windows, and there is already a Windows build available, very elegant – just one 10MB file called node.exe:) – albeit unstable. Anyway, as of version 0.5.4 it seems to be capable of running UglifyJS. You just need to set the NODE_PATH environment variable accordingly:

set NODE_PATH=C:\EXE\UglifyJS
C:\EXE\node C:\EXE\UglifyJS\bin\uglifyjs options script-file

(Of course you should correct the pathnames to point to the locations of UglifyJS and node.exe on your system.)


转自:http://blog.dmitryleskov.com/web-development/javascript/howto-run-uglifyjs-javascript-minifier-windows-using-node/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值