目前我正致力于 J2EE 应用程序的速度优化。 应用程序的性能目前(在我的例子中服务器运行得非常快)更多取决于下载相关文件所花费的时间 比如js, css等
My Question:
Is there any way to compress these files(js, css, images etc..) and send it to client machine?
我已经通过一些将js压缩成一行的技术,但是它导致当前语法出现一些问题。
I like to know some way to compress and sent the files, if possible, for best client-side performance.
最佳答案
基本上有两种实现此功能的方法如下
1) 使用在线可用的 minfy 工具缩小你的 css 和 js。
我使用 Google Closure Tools,它使用 Rhino 来解释您的代码,同时修改它以确保它在缩小后仍然有效。存在许多免费工具:YUI Compressor、UglifyJS 等。
UglifyJS 也不错,在这里试试 http://marijnhaverbeke.nl/uglifyjs
谷歌关闭工具:https://developers.google.com/closure/
2) Gzip 你的 css 和 js.Do server specific configuration to use Gzip
我有一个链接,您可以从中了解 GZip 的工作原理
http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
关于java - J2EE 应用程序中的速度优化,客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24298933/