Google Closure Compiler generally achieves smaller files than YUI Compressor, particularly if you use the advanced mode, which looks worryingly meddlesome to me but has worked well on the one project I've used it on:
Several big projects use UglifyJS, and I've been very impressed with it since switching.
If you are using PHP you might also want to take a look at minify which can minify and combine JavaScript files. The integration is pretty easy and can be done by defined groups of files or an easy query string. Minified files are also cached to reduce the server load and you can add expire headers through minify.
发布评论
评论(9)
UglifyJS2,由 jQuery 项目使用。
UglifyJS2, used by the jQuery project.
活动
已弃用
Google Closure Compiler 通常会生成比 YUI Compressor 更小的文件,特别是如果您使用高级模式,这对我来说看起来很麻烦,但在我使用它的一个项目中效果很好:
几个大项目使用 UglifyJS,自从切换以来我对它印象深刻。
Active
Deprecated
Google Closure Compiler generally achieves smaller files than YUI Compressor, particularly if you use the advanced mode, which looks worryingly meddlesome to me but has worked well on the one project I've used it on:
Several big projects use UglifyJS, and I've been very impressed with it since switching.
JavaScript Minifier 提供了一个很好的 API,您可以通过编程方式使用:
或者通过上传文件并重定向到新文件:
希望有帮助。
JavaScript Minifier gives a good API you can use programatically:
Or by uploading a file and redirecting to a new file:
Hope that helps.
如果您使用 PHP,您可能还想看看 minify,它可以缩小和组合JavaScript 文件。集成非常简单,可以通过定义的文件组或简单的查询字符串来完成。缩小的文件也会被缓存以减少服务器负载,您可以通过 minify 添加过期标头。
If you are using PHP you might also want to take a look at minify which can minify and combine JavaScript files. The integration is pretty easy and can be done by defined groups of files or an easy query string. Minified files are also cached to reduce the server load and you can add expire headers through minify.
您可以使用/尝试以下几种:
There are several you can use/try:
漂亮的差异 - http://prettydiff.com/?m=minify
Pretty Diff - http://prettydiff.com/?m=minify
有时我使用这个: http://closure-compiler.appspot.com/home
Sometimes i use this: http://closure-compiler.appspot.com/home
这个工具:jscompressor.com 非常不错。
This tool: jscompressor.com is pretty good.
YUI 压缩器
YUI minifier