博客 - html/css/xml/xsl

推荐一款js css压缩工具TBCompressor

  淘宝是怎么压缩js和css的?他们使用的是YUI Compressor:

The YUI Compressor is a JavaScript compressor which, in addition to removing comments and white-spaces, obfuscates local variables using the smallest possible variable name. This obfuscation is safe, even when using constructs such as ‘eval’ or ‘with’ (although the compression is not optimal is those cases) Compared to jsmin, the average savings is around 20%.

The YUI Compressor is also able to safely compress CSS files. The decision on which compressor is being used is made on the file extension (js or css)

  淘宝前端的开发环境以Windows居多。为了方便使用,对YUICompressor做了层简单的封装,称之为TBCompressor.

  今天偶自己试用了一下,的确是非同小可。不仅操作方法简单,而且效率也非常的高!唯一有点麻烦的就是需要安装JDK,并配置JAVA_HONE环境变量。偶本人虽然不懂JAVA,但是以前在学习一本关于AJAX的书时配置过JAVA,因此这次轻车熟路般的顺利完成。

  测试了几次,大概效率是,1/2!非常不错了吧!

介绍:http://lifesinger.org/blog/?p=464

下载:tbcompressor-2.4.2.zip (808.3 KB)

  之前一直都使用ECMAScript Cruncher,也是一款非常不错的文件最小化和变量名替换的工具。作者:Thomas Loo。操作起来略显复杂(与TBCompressor),需要在Windows下运行Esc,并输入一段代码。可以按等级优化代码,一共分四级。这里就不意义介绍了。有兴趣可以去http://www.saltstorm.net/depo/esc/查看相关资料并下载试用!

标签:

写下您的看法

  • :em18:
  • :em12:
  • :em03:
  • :em08:
  • :em06:
  • :em05:
  • :em07:
  • :em15:
  • :em11:
  • :em16:
  • :em01:
  • :em17:
  • :em10:
  • :em13:
  • :em14:
  • :em02:
  • :em09:
  • :em04:

仅支持“a、abbr、strong、em、blockquote、code”几个简单的标签

使用腾讯微博登陆 使用新浪微博登陆