I'm trying to set up a script in package.json which runs all my various watches for Coffeescript/Sass/etc.
This is the script I'm using on my server, which works fine.
"dev": "coffee --watch --compile js/ & coffee --watch --compile controllers/ & supervisor -e html,js js/index.js",
When I try that same script locally however, it only seems to run the first command. Windows doesn't seem like it knows what to do with the &. Every command there works fine run individually, but they won't all execute together.
I developed concurrently just for this purpose. For example cat a & cat b
can be achieved with concurrently 'cat a' 'cat b'
. Concurrently also provides a few output formatting options for convenience.
Install it as dev dependency npm install --save-dev concurrently
and then it's ready to be used in package.json "scripts".
For Windows, the built-in equivalent to &
is instead prefixing the command with start /B
. So you may just have "dev" set to a small node script that uses the built-in child_process
to do something like:
var exec = require('child_process').exec;
var prefix = (process.platform === 'win32' ? 'start /B ' : '');
exec(prefix + 'coffee --watch --compile js/');
exec(prefix + 'coffee --watch --compile controllers/');
exec(prefix + 'supervisor -e html,js js/index.js');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With