#!/bin/bash if [ ! "$(pwd | grep scripts$)" ] ; then echo "Working directory is wrong!" exit 1; fi . _defines.sh JAVA=$(which java) COMPRESSOR="${BASE_PATH}/site/bin/yuicompressor.jar" COMPRESSOR_OPT="-Xmx128m" CURRENT_DIR=`pwd` cd $WWW_PATH FILE_LIST=$(find ./js -name '*.js' -type f | grep -Fv '.pack.' | grep -Fv '.merge.' | grep -Fv './js/ckeditor/') FILE_LIST="$FILE_LIST ./js/ckeditor/ckeditor.js" if test -n "$FILE_LIST" ; then echo "> packing js files ..." $JAVA $COMPRESSOR_OPT -jar $COMPRESSOR -o '.js$:.pack.js' $FILE_LIST 2>&1 fi FILE_LIST=$(find ./css -name '*.css' -type f | grep -Fv '.pack.' | grep -Fv '.merge.') if test -n "$FILE_LIST" ; then echo "> packing css files ..." $JAVA $COMPRESSOR_OPT -jar $COMPRESSOR -o '.css$:.pack.css' $FILE_LIST 2>&1 fi echo "> removing *.pack.merge.css files ..." find ${WWW_PATH}/js -type f -name '*.pack.merge.js' -exec rm -f {} \; echo "> removing *.pack.merge.css files ..." find ${WWW_PATH}/css -type f -name '*.pack.merge.css' -exec rm -f {} \; cd $CURRENT_DIR exit 0