缩小基于jQuery的js文件 [英] Minify jQuery based js files
问题描述
我们在我们的项目中使用jQuery。我们有许多自定义javascript文件在我们的网络应用程序有UDFs利用jQuery的功能。我们需要减少大小(作为性能改进活动的一部分),我正在寻找一个可靠的minifier这些文件(如果相同的工具可以缩小CSS文件太大了)
We are using jQuery in our project. We have numerous custom javascript files in our web-app that have UDFs utilizing the jQuery features. We need to reduce the size (as a part of performance improvement activities) and I am looking for a reliable 'minifier' for these files (it would be great if the same tool could minify the CSS files too)
我们尝试了JSLint和JSMin,但JSLint在遇到jQuery代码时不会完成并抛出许多异常。
We tried JSLint and JSMin - but JSLint does not complete and throws many exceptions as soon as it encounters jQuery code.
推荐答案
YUI Compressor 是我使用的工具,它会压缩JS和CSS很好,它是用Java编写的(所以你可以通过蚂蚁工作到一个构建过程)。
The YUI Compressor is a tool I use, it compresses both JS and CSS well, and it is written in Java (so you can work it into a build process via ant).
有人甚至做了一个在线版本。
这篇关于缩小基于jQuery的js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!