Created
December 20, 2013 21:39
-
-
Save mmas/8062064 to your computer and use it in GitHub Desktop.
Simple githook pre-commit. Uglify javascript and compile and compress less to css. Save as .git/hooks/pre-commit. uglifyJS2 - https://github.com/mishoo/UglifyJS2
lessc - https://github.com/less/less.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# uglifyJS2 - https://github.com/mishoo/UglifyJS2 | |
# lessc - https://github.com/less/less.js | |
STYLES=$(pwd)/PATH/TO/MAIN/LESS/FILE | |
JS_ROOT=$(pwd)/PATH/TO/JAVASCRIPT/FOLDER | |
echo "Uglifying javacript..." | |
for i in $(find $JS_ROOT -name "*.js" -not -name "*.min.js") | |
do | |
o=${i/.js/.min.js} | |
uglifyjs $i -m -c -o $o | |
git add $o | |
done | |
echo 'Done' | |
echo "Compiling less to css..." | |
i=$STYLES | |
o=${i/.less/.css} | |
lessc -x $i $o | |
git add $o | |
echo 'Done' | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment