Nodemon does not reload after yaml files change.
How can I configure nodemon to reload the server when a yaml
file changes?
nodemon can also be configured using a config file.
Create a file named nodemon.json and place it in the root of your project, for example where your project's package.json file already is.
If you want to add .yaml to the default extensons watched, put this code in your nodemon.json
{
"ext": ".js, .mjs, .coffee, .litcoffee, .json, .yaml"
}
You can configure nodemon to watch your yaml
files in two ways:
The documentation states that:
By default, nodemon looks for files with the
.js
,.mjs
,.coffee
,.litcoffee
, and.json
extensions.You can specify your own list with the
-e
(or--ext
) switch
Like so:
nodemon -e yaml server.js
Note: the dot before the extension .yaml
is not mandatory, you can omit it.
Now when any .yaml
file changes, your server will restart.
You can use the flag -w
(or --watch
)
The wiki says:
Watch directory "dir" or files. use once for each directory or file to watch.
Like so:
nodemon -w file1.yaml -w file2.yaml server.js
You'll see something like
[nodemon] watching: file1.yaml file2.yaml
Now when one of these two files changes it will restart, but it wont' watch another .yaml
file if it is not specified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With