Home > Web Front-end > JS Tutorial > body text

ANT compresses (removes spaces/comments) JS files to improve js running speed_extjs

WBOY
Release: 2016-05-16 17:37:04
Original
1431 people have browsed it

1. Explain that when using extjs, the operation is relatively stuck, especially when there is too much running data and js, it will be stuck or the waiting time will be relatively long.
There are many optimization methods to solve this problem. One of them today is to remove spaces and comments in js when packaging Ant scripts, and merge them. I won’t talk about merging today. This has not been implemented yet. Under research
2. First, you need to prepare two .jar files, namely YUIAnt.jar and yuicompressor-2.4.x.jar.
3. Attachments of the two files
Download address
4. The build.xml file is as follows

Copy code The code is as follows:

















< ;fileset dir="${basedir}">





Copy Code The code is as follows:


















































5、在这里说一点,在使用js压缩的时候YUIAnt.jar 是不支持utf-8字符集的。即
复制代码 代码如下:

encoding="utf-8

下载地址
7、个人感受,在弄了很小半天,吧这个问题搞定了,自以为可以提高点js加载速度了,结果还是有点小慢,没有jquery那么的快,估计要用gzjs压缩才会变快点,现在我分析是的在IE下运行速度比较慢点,在firefox下比较快,看来还是每个模块加载的js有点多。
优化速度对比:
ANT compresses (removes spaces/comments) JS files to improve js running speed_extjs
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template