例如:
"scripts": {
"watch": "coffee --watch --compile .; compass watch public/compass"
},
我怎样才能使这个工作,所以它编译我的coffescripts和我的指南针项目?
答案 0 :(得分:18)
http://substack.net/task_automation_with_npm_run
顺序子任务
如果你想要连续运行2个任务,你可以只运行由&&amp ;:
分隔的每个任务"build": "npm run build-js && npm run build-css"
并行子任务
如果您想并行运行某些任务,只需使用&作为分隔符!
"watch": "npm run watch-js & npm run watch-css"
答案 1 :(得分:2)
npm install parallelshell --save-dev
&
"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\""
$ npm start
---或者---
创建一个.js文件,通过Node.js child_process旋转多个进程。这是一个例子:
"start": "node tools/start.js"
tools/start.js
可能如下所示:
https://github.com/kriasoft/aspnet-starter-kit/blob/master/tools/start.js