Node自动重启工具 nodemon
Node自动重启工具 nodemon
安装
npm install -g nodemon
or
npm install --save-dev nodemon
参数
nodemon -h
显示:
Options:
--config file ............ alternate nodemon.json config file to use // 备用nodemon.json配置文件使用
-e, --ext ................ extensions to look for, ie. js,jade,hbs. // 监控指定后缀名的文件
-x, --exec app ........... execute script with "app", ie. -x "python -v". // 执行的命令
-w, --watch dir........... watch directory "dir" or files. use once for // 监控文件夹
each directory or file to watch.
-i, --ignore ............. ignore specific files or directories. // 忽略特定的文件或目录
-V, --verbose ............ show detail on what is causing restarts. // 显示导致重新启动的详细信息
-- <your args> ........... to tell nodemon stop slurping arguments. // 告诉nodemon停止参数
Note: if the script is omitted, nodemon will try to read "main" from
package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee,
and .litcoffee by default.
For advanced nodemon configuration use nodemon.json: nodemon --help config
See also the sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json
Examples:
$ nodemon server.js
$ nodemon -w ../foo server.js apparg1 apparg2
$ nodemon --exec python app.py
$ nodemon --exec "make build" -e "styl hbs"
$ nodemon app.js -- --config # pass config to app.js
使用
"build:framework": "nodemon -w src --exec npm run build",
"build:dist": "node ./bin/weweb ./test",
"start:dev": "nodemon -w test -w lib/template -e js,json,wxss,wxml --exec npm run build:dist"
作者:孟繁贵 Email:meng010387@126.com 期待共同进步!