最近检测服务器,发现js/css文件都没有压缩过,动手解决此问题先。
本次压缩采用 yui compress (2.4.8)
压缩脚本:
#!/bin/sh echo "###########################" echo "---------------------------" echo "begin to compress JS file." for file in `find . -name "*.js"` do echo "Compressing $file …" java -jar yuicompressor-2.4.8.jar -type js -o $file $file done echo "compress js file compeleted." echo "---------------------------" echo "begin to compress css file." for file in `find . -name "*.css"` do echo "Compressing $file …" java -jar yuicompressor-2.4.8.jar -type css -o $file $file done echo "compress CSS file compeleted." echo "---------------------------"
解压附件中的文件,直接在当前文件夹(包括子文件夹)中即可完成对js/css文件的压缩
文件地址: http://files.cnblogs.com/AloneSword/js_css-comparess.zip