JavaScript 压缩
我正在寻找可以压缩JavaScript源代码的工具。我发现一些网络工具只能删除空白字符?但也许存在更好的工具,可以压缩用户的函数名称、字段名称、删除未使用的字段等。
I look for tool which can compress JavaScript source code. I found some web tools which only deletes whitespace chars? But maybe exist better tool which can compress user's function names, field name, deletes unused fields, others.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经常用于压缩 JS 代码的工具是 YUI Compressor。
考虑到有这个选项:
它应该能够执行您所要求的操作。
这里有一篇关于它的文章:YUI 压缩机简介。
引用那篇文章:
旁注:当从网络服务器提供 JS/CSS 文件时,不要忘记对它们进行 gzip 压缩:这将大大减少通过网络的数据大小!
例如,如果您使用的是 Apache,请查看
mod_deflate< /代码>
。
A tool often used to compress JS code is the YUI Compressor.
Considering there is this option :
It should be able to do what you asked.
And here is an article about it : Introducing the YUI Compressor.
Quoting that article :
As a sidenote : don't forget to gzip your JS/CSS files, when serving them from your webserver : this will reduce the size of data that goes through the network quite a lot !
For instance, if you are using Apache, take a look at
mod_deflate
.查看YUI 压缩机,还有YUI 压缩机。 saltstorm.net/depo/esc/" rel="nofollow noreferrer">ESC,但我怀疑 YUI 更好一些。由你来测试。
Check out YUI Compressor, there is also ESC, but I suspect YUI is a bit better. Up to you to test.
Javascript 最小化器已讨论此处 之前,但我仍然觉得 JavaScript 压缩器评级网页总结了它们最好的:
Javascript minimizer have been discussed here before, but still I feel that the JavaScript compressor rater web page summarizes them best: