Taking the following scripts section from a package.json
:
"scripts":{
"sass:watch": "npm run sass -- -w ./src/public/stylesheets -r --source-map true",
"livereload": "live-reload --port 9091 ./src/**/*",
"dev:watch" : "npm run sass:watch; npm run livereload"
}
How can I successfully get both the sass:watch
and livereload
tasks to run, without blocking each other, from the dev:watch
task?
Currently, when I run npm run dev:watch
sass:watch
blocks livereload
.
If I reorder them, the same problem occurs.
Use a single ampersand:
"dev:watch" : "npm run sass:watch & npm run livereload"
&&
runs tasks in serial; &
in parallel.
you could try the concurrently package for npm
npm install concurrently --save-dev
then use it to run both of your script:
"dev:watch": "concurrently \" npm run sass:watch \" \" npm run livereload \" ",
you can find info about the package here: https://www.npmjs.com/package/concurrently
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