Skip to content

Instantly share code, notes, and snippets.

@pixxelboy
Forked from yannickcr/make-js.sh
Created July 12, 2011 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixxelboy/1078027 to your computer and use it in GitHub Desktop.
Save pixxelboy/1078027 to your computer and use it in GitHub Desktop.
A simple shell script to loop through your javascripts and give them to sprocket and uglifyjs
SOURCEPATH=/path/to/javascripts/sources
BUILDPATH=/path/to/compiled/javascripts
NODEPATH=/path/to/node
UGLIFYPATH=/path/to/uglifyjs
SPROCKETPATH=/path/to/sprocketize
cd $SOURCEPATH
for f in *.js;
do
echo "Processing $f file...";
echo "Concatenating...";
$SPROCKETPATH $f > $BUILDPATH/$f;
echo "Compressing...";
$NODEPATH $UGLIFYPATH $BUILDPATH/$f > $BUILDPATH/tmp$f;
mv $BUILDPATH/tmp$f $BUILDPATH/$f;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment