压缩css与js

使用yuicompressor 进行css和js的压缩


#! /bin/sh
yasuocss="java -jar /root/yuicompressor-2.4.8.jar --type css --charset utf-8"
yasuojs="java -jar /root/yuicompressor-2.4.8.jar --type js --charset utf-8"
######################css
for file in ./SGMag/sites/media/css/sgmag/*.css ./SGMag/sites/media/css/*.css
do
echo "$file"
echo "$file"bk
mv $file "$file"bk
$yasuocss $file"bk" > $file
echo "$file"
done
#######################js
for file in ./SGMag/sites/media/component/*.js ./SGMag/sites/media/*.js ./SGMag/sites/media/pagejs/*.js
do
echo "$file"
echo "$file"bk
mv $file "$file"bk
$yasuojs $file"bk" > $file
echo "$file"
done
########################报错处理
cp -rf ./SGMag/sites/media/pagejs/cluster/hosttools.jsbk ./SGMag/sites/media/pagejs/cluster/hosttools.js