TBCompressor - JS和CSS压缩工具

转自岁月如歌http://lifesinger.org/blog/?p=464

 

有朋友问到淘宝是怎么压缩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. 安装和使用方法如下:

安装说明
  1. 安装请点击install.cmd
  2. 卸载请点击uninstall.cmd
  3. 如果以前安装过2.3.5之前的版本, 请点击update.cmd升级
测试使用
  1. 在test.source.js上右键,执行菜单“压缩JavaScript”,会生成test.js文件。如果再对test.js文件执行一次压缩,会生成test-min.js文件
  2. CSS同1
下载试用
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值