简体   繁体   English

打开bash并在npm start上运行命令

[英]Open bash and run command on npm start

When I start my app, I do it by running npm start . 启动我的应用程序时,我可以通过运行npm start Right now, npm start only runs my server.js . 现在, npm start只运行我的server.js Is it possible to have npm start open a new bash prompt and run eg grunt watch to start the task that watches my less/stylus etc? 是否有可能让npm start打开一个新的bash提示并运行例如grunt watch来启动grunt watch我的less / stylus等的任务?

It would be nice to not have to manually start the watch task each time. 不必每次都手动启动watch任务会很好。

Simply specify a custom start script: 只需指定一个自定义启动脚本:

"scripts": {
    "start": "node server.js & grunt watch"
}

https://www.npmjs.org/doc/misc/npm-scripts.html https://www.npmjs.org/doc/misc/npm-scripts.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM