Created
December 22, 2016 16:54
-
-
Save romaninsh/e6c783ec916ae176f55e3ee6b5e43b73 to your computer and use it in GitHub Desktop.
Watch your .pug and .jade files
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 | |
## 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
I have improved the script by also compiling less files: