Created
May 12, 2013 04:04
-
-
Save avilaj/5562379 to your computer and use it in GitHub Desktop.
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
#! /bin/bash | |
# Vigila cambios en archivos coffe y stylus y los compila | |
# Se debe iniciar en el directorio padre de las dos carpetas | |
# Osea si el archivo se encuentra en proyecto/estaticos/coffe | |
# Se debe iniciar en proyecto/estaticos/ | |
function notify { | |
notify-send -i applications-development -t 500 "Compilado!" $1 | |
echo $1 | |
} | |
compile(){ | |
# DIRECTORIOS | |
if [ -z $1 ] | |
then | |
DIRECTORIO=/var/www/laravel/php | |
else | |
DIRECTORIO=${PWD} | |
fi | |
JS=$DIRECTORIO/js | |
CSS=$DIRECTORIO/css | |
STYLUS=$DIRECTORIO/stylus | |
COFFEE=$DIRECTORIO/coffee | |
notify-send -i applications-development -t 500 "Observando directorio" $DIRECTORIO | |
while FILE=$(inotifywait -rq --format '%f' -e create -e modify $DIRECTORIO); | |
do | |
if [[ $FILE =~ .*.coffee ]] | |
then | |
MSG=$(coffee -o $JS/ -cbl $COFFEE/$FILE) | |
notify "$FILE" | |
elif [[ $FILE =~ .*.styl ]] | |
then | |
MSG=$(stylus $STYLUS/$FILE -o $CSS/) | |
notify "$FILE" | |
fi | |
sleep 1 | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment