写个脚本压缩JS,CSS

1、下载最新版的yuicompressor.jar

1
https://github.com/yui/yuicompressor/releases

2、遍历目录,压缩JS、CSS

1
2
3
4
5
6
#!/bin/bash
for i in `find path -name "*.css"`;
do
echo "compress $i"
java -jar yuicompressor-2.4.8.jar --charset=utf8 -o $i $i --nomunge
done

script>