Run script on change in nodemon

≡放荡痞女 提交于 2020-08-07 08:15:07

问题


Is it possible to run a script on change using nodemon?

Is it possible to do something like this: nodemon --watch src --exec yarn run my-script?

So, ideally I'd like to run a script only when there're changes in a src folder


回答1:


As indicated in the Nodemon docs you can add a restart event command in nodemon.json:

{
  "events": {
    "restart": "yarn my-script"
  }
}



回答2:


Just put quotes around your script that you want to execute

nodemon --watch src --exec "yarn run my-script"



来源:https://stackoverflow.com/questions/51225277/run-script-on-change-in-nodemon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!