Created
July 5, 2012 23:59
-
-
Save shanna/3057217 to your computer and use it in GitHub Desktop.
Watch and compile JS and CSS.
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
templates: | |
cd web/templates && haml-coffee -i . -n this.nd.templates -o ../js/nd-templates.js | |
css: | |
cd web/css && recess nd.less --compile > ../../public/nd.css | |
app: | |
cd web/app && coffee -cj ../js/nd.js nd.coffee | |
js: | |
cd web/js && cat moment.js underscore.js backbone.js nd-templates.js nd.js | uglifyjs -nc -o ../../public/nd.js | |
watch: | |
./bin/nd-watch | |
install: | |
mkdir -p web/templates web/css web/app web/js public | |
sudo npm install -g recess coffee-script uglify-js haml-coffee | |
all: css templates app 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
#!/bin/bash | |
root=$(readlink -f $(dirname $0)/..) | |
cd $root | |
inotifywait -qrm --format '%w%f' -e close_write -e delete "$root" | while read file; do | |
# Ignore dot directories. | |
[[ $(dirname $file) =~ /\. ]] && continue | |
# Ignore dotfiles. | |
[[ $(basename $file) =~ ^\.|\.lock$ ]] && continue | |
file="${file#$root/}" | |
if [[ $file =~ web/templates/.*\.haml\.coffee ]]; then | |
echo $file | |
make templates > /dev/null | |
elif [[ $file =~ web/css/.*\.less ]]; then | |
echo $file | |
make css > /dev/null | |
elif [[ $file =~ web/app/.*\.coffee ]]; then | |
echo $file | |
make app > /dev/null | |
elif [[ $file =~ web/js/.*\.js ]]; then | |
echo $file | |
make js > /dev/null | |
elif [[ $file =~ public/ ]]; then | |
# TODO: Not quite true, a delete in public/ would trigger this. | |
echo "> $file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment