I have a bunch of JS files that I split up, but want to concatenate automatically (so I don't define a bunch of files in HTML). Right now, I copied the command from Twitter Bootstrap. Makefile:
scripts:
cat scripts/*.js > public/scripts/scripts.js
watchScripts:
watchr -e "watch('scripts/.*\.js') {system 'make scripts'}"
However, I've found watchr
to be very inconsistent (on Mac OS X 10.8)
- Sometimes when I save a
js
file, it doesn't runmake scripts
. Other times, it does. - One time, it just kept running
make scripts
continuously after a single save. - Sometimes, it will run the command a few seconds after the last save.
Am I doing something wrong? I'm working using node.js
and not Ruby
, so are there any node.js
command-line alternatives? The same issues seem to happen to me when I try make watch
in Bootstrap.
Aside question: I have another watch command:
stylus -w -u nib styles/styles.styl -o public/styles
How can I run two watch commands in a single Makefile command? IE make watch
will watch both .styl
files to compile, and .js
files to concatenate. Right now I'm opening up two terminals, for each watch command, but I'd prefer a single one.