Watch your .pug and .jade files
#!/bin/bash | |
## Save this file into ~/bin and make it writeable (chmod +x pugwatch) | |
## Execute it from your project folder, e.g. ~/Sites | |
## It starts up very fast, takes no memory and will instantly compile any | |
## JADE / PUG files as soon as you create them. | |
## All dependencies will be installed automatically too. | |
## Created this because CodeKit (which I purchased) keeps hanging and crashing and being slow for a few years now | |
# Check for dependencies | |
which fswatch >/dev/null || brew install fswatch | |
which terminal-notifier >/dev/null || brew install terminal-notifier | |
which npm >/dev/null || brew install npm | |
which pug >/dev/null || npm install pug-cli -g | |
echo "Watching for .pug and .jade.." | |
fswatch -e '.*' -i '.jade$' -i '.pug$' . | while read x | |
do | |
pug "$x" \ | |
&& terminal-notifier -group pug -title 'PUG Compiler' -subtitle 'Success' -message "$x" \ | |
|| terminal-notifier -group pug -title 'PUG Compiler' -subtitle 'Failed' -message "$x" -sound Funk -action com.apple.Terminal | |
done | |
#Clicking on notification won't open terminal due to bug: | |
# https://github.com/julienXX/terminal-notifier/issues/180 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
I have improved the script by also compiling less files: