Created
December 9, 2011 23:38
-
-
Save Arwid/1453830 to your computer and use it in GitHub Desktop.
Bash compile script for assets: Coffee JS, Libs, CSS
This file contains hidden or 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
#!/bin/bash | |
COMPRESS=true | |
YUI_COMPRESSOR_PATH="../../tools/YUI_Compressor/build/yuicompressor-2.4.6.jar" | |
### JS FILES ### | |
# CONFIG | |
MAIN_FILE_NAME="app" | |
MAIN_FILE_PATH="../assets/$MAIN_FILE_NAME.js" | |
COMPILED_FILE_PATH="../assets/${MAIN_FILE_NAME}-compiled.js" | |
# Convert JS to Coffee | |
coffee --join ${COMPILED_FILE_PATH} --compile {./app*.coffee,./models/,./routers/,./views/,./init*.coffee} | |
# Compress | |
if [ $COMPRESS = true ]; then | |
java -jar $YUI_COMPRESSOR_PATH ${COMPILED_FILE_PATH} -o ${COMPILED_FILE_PATH} --charset utf-8; | |
fi | |
### LIB FILES ### | |
# Config | |
COMPILED_LIB_FILE_NAME="lib" | |
COMPILED_LIB_FILE_PATH="../assets/${COMPILED_LIB_FILE_NAME}-compiled.js" | |
# Concatenate | |
echo "" > ${COMPILED_LIB_FILE_PATH} | |
for f in ./lib/{json2.js,underscore.js,zepto.js,handlebar.js,backbone.js,backbone-localstorage.js}; do cat "$f" >> ${COMPILED_LIB_FILE_PATH}; done | |
# Compress | |
if [ $COMPRESS = true ]; then | |
java -jar $YUI_COMPRESSOR_PATH ${COMPILED_LIB_FILE_PATH} -o ${COMPILED_LIB_FILE_PATH} --charset utf-8 | |
fi | |
### CSS FILES ### | |
# Config | |
COMPILED_CSS_FILE_PATH="../assets/styles-compiled.css" | |
# Concatenate | |
echo "" > ${COMPILED_CSS_FILE_PATH} | |
for f in ../css/*.css; do cat "$f" >> ${COMPILED_CSS_FILE_PATH}; done | |
# Compress | |
if [ $COMPRESS = true ]; then | |
java -jar $YUI_COMPRESSOR_PATH ${COMPILED_CSS_FILE_PATH} -o ${COMPILED_CSS_FILE_PATH} --charset utf-8 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment