Question

For example:

"scripts": {
    "watch": "coffee --watch --compile .; compass watch public/compass"
}, 

How can I get this working, so it compiles my coffescripts and my compass project?

Was it helpful?

Solution

http://substack.net/task_automation_with_npm_run

sequential sub-tasks

If you have 2 tasks you want to run in series, you can just npm run each task separated by a &&:

"build": "npm run build-js && npm run build-css"

parallel sub-tasks

If you want to run some tasks in parallel, just use & as the separator!

"watch": "npm run watch-js & npm run watch-css"

OTHER TIPS

Install parallelshell npm pacakge

npm install parallelshell --save-dev

Use it instead of & in your npm script(s)

"build": "echo TODO: build the project and start watching",
"serve": "echo TODO: start a development web server",
"start": "parallelshell \"npm start build\" \"npm start serve\""

Run multiple sub-tasks in parallel (Mac, Linux, Windows)

$ npm start

--- alternatively ---

Create a .js file that spins multiple processes via Node.js child_process. Here is an example:

"start": "node tools/start.js"

Where tools/start.js may look like this:

https://github.com/kriasoft/aspnet-starter-kit/blob/master/tools/start.js

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top