ccooper%deadsquid.com 49044f4d98 - always create Litmus.js even if jsmin isn't present
git-svn-id: svn://10.0.0.236/trunk@241913 18797224-902f-48f8-a5cc-f745e15eee43
2007-12-21 15:24:47 +00:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Create a single master JS file out of our littler files.
# This cuts down the number of HTTP requests, and with content
# deflation (gzip) the initial download still isn't that bad.
if [ ! -d "js" ]; then
echo "Couldn't find your js/ dir. Did you run the script from your root Litmus dir? You should."
exit 1
fi
cd js
cat Help.js \
prototype.lite.js \
json.js moo.fx.js \
moo.fx.pack.js \
MochiKit/MochiKit.js \
FormPersist.js \
FormValidation.js \
Search.js \
SelectBoxes.js \
SelectSort.js \
TestRunCoverage.js \
> Litmus.js
# Back up original js files, and then minimize them.
#
# Note: this will cause subsequent 'cvs update' calls to complain.
# You'll want something like the following to cleanout your JS dir
# prior to a cvs update (remember to backup any local changes first!):
#
# From js/:
# for i in `find . | grep '\.js'`; do rm $i; done; cvs update -dP
minify=`which jsmin 2>/dev/null`
if [ "XXX$minify" == "XXX" -o ! -e "$minify" ]; then
echo "jsmin not found in \$PATH. Skipping JS minification"
exit 0
fi
for i in `find . -name \*.js -print 2>/dev/null`; do
echo -n "Minifying $i..."
cp $i $i.preminify
$minify <$i.preminify >$i
echo "Done."
done