Skip to content

Instantly share code, notes, and snippets.

@yannickcr
Created March 25, 2011 00:49
Show Gist options
  • Save yannickcr/886181 to your computer and use it in GitHub Desktop.
Save yannickcr/886181 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