Ted*_*Ted 38 javascript jquery minify google-closure google-closure-compiler
有没有人针对谷歌新发布的Closure编译器编译jQuery ?
据报道,代码大小节省了大量资金.我很好奇如果用它编译jQuery会带来什么好处.
Nos*_*dna 27
John Resig在尝试编译每晚jQuery 1.4时报告了一个关于递归函数的错误,所以有一些问题需要解决.我不会使用使用Closure Compiler编译的jQuery而不确保它通过jQuery测试平台.
http://code.google.com/p/closure-compiler/issues/detail?id=1&can=1#c2
jit*_*ter 12
我试过jQuery jQuery 1.3.2
jQuery-1.3.2.min.js 57254 Bytes
jQuery closure compiler 49730 Bytes
-----------------------------------
Reduced by 7524 Bytes
Saved 13.31% off the original size
Saved 10.87% off the gzipped size
Run Code Online (Sandbox Code Playgroud)
获得~7KB
但它也报告了15个警告,我没有测试它是否仍然有效
闭包编译器会删除您实际不使用的任何代码.典型的网页只使用一小部分jQuery函数,因此最大的好处将来自编译代码和完整版本的jQuery.
关闭ADVANCED_OPTIMIZATIONS:
打开ADVANCED_OPTIMIZATIONS:它无法正常工作.打开ADVANCED_OPTIMIZATIONS并找到导出导出的所有东西......它仍然不能正常工作,并且代码已经达到53466字节(并且18785 gzipped,这比没有ADVANCED_OPTIMIZATIONS的gzipped闭包代码更多)所以它看起来不像是一个胜利的主张.
从jQuery 1.4开始,Google的Closure Compiler被用作jQuery版本的默认缩小技术.但是,jQuery仅使用SIMPLE_OPTIMIZATIONS设置.jQuery团队没有计划支持ADVANCED_OPTIMIZATIONS.
闭包不只是最小化并重命名变量吗?jQuery 已经有 .min 版本。再次用闭包进行缩小可能没有什么帮助,而且有潜在的危险。
编辑:我刚刚做到了。
Compilation was a success!
Original Size: 55.91KB (19.28KB gzipped)
Compiled Size: 54.05KB (18.28KB gzipped)
Saved 3.34% off the original size (5.18% off the gzipped size)
Run Code Online (Sandbox Code Playgroud)
这是在已经挖掘的版本之上。这里有一个演示: http: //closure-compiler.appspot.com/home
归档时间: |
|
查看次数: |
21807 次 |
最近记录: |