Skip to content

Instantly share code, notes, and snippets.

@kensei
Last active December 14, 2015 09:28
Show Gist options
  • Save kensei/5064705 to your computer and use it in GitHub Desktop.
Save kensei/5064705 to your computer and use it in GitHub Desktop.
yui && gzip
#!/bin/sh
JAVABIN="$HOME/LOCAL/java/jdk1.6.0_41/bin/java"
YUIBIN="$HOME/LOCAL/java/yuicompressor-2.4.7/build/yuicompressor-2.4.7.jar"
temp_dir="$HOME/LOCAL/deploy/yuitemp"
alias yui="${JAVABIN} -jar ${YUIBIN} -v --charset UTF-8"
if [ ! -e $temp_dir ]; then
mkdir $temp_dir
fi
target_files=$(find /var/www/site/static \( -name "*.css" -o -name "*.js" \) -type f 2>&1)
if [ $? -ne 0 ]
then
echo
echo " $changes"
echo
exit 1
fi
echo "-- target files --"
for file in $target_files;
do
echo "target : $file"
copypath=$(echo $file | sed 's/.*\///')
temp_file="$temp_dir/$copypath"
cp $file $temp_file
yui $file -o $temp_file
gzip -c $temp_file > $file.gz
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment