7

Is there a way to specify watch list using config files instead of command line?


Command line method in nodemon's doc:

nodemon github


I attempted to use a nodemon.json config file with the following:

{ 
"ext": ["js", "json", "hbs", "html"]
}

Returned an 'extension.match' error.

Then I tried to add the config to package.json with the below:

{...
"nodemonConfig": {
    "ext": ["js", "json", "hbs", "html"]
  }
...}

Also same error.

I have a feeling both approaches are on the right track, but I'm missing something.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Enrichdev
  • 83
  • 2
  • 8

3 Answers3

15

You can use a nodemon.json file in the root of your application you were almost there but the syntax is slightly different to what you had the correct syntax would look like this:

{
    "ext": "js,json,hbs,html"
}
Lucas
  • 598
  • 9
  • 18
7

Nodemon also supports using package.json for configuration, under nodemonConfig key.

The config is in the same format as in the nodemon.json config file:

package.json

{
  ...
  "nodemonConfig": {
    "ext": "js,json,hbs,html",
    ...
  }
}
andreivictor
  • 7,628
  • 3
  • 48
  • 75
2

Step 1: First you add nodemon.json file in the root of your project. (For example if you have a Weather-App Project first you add nodemon.json in the root.)

      Weather-App _
                   |_ nodemon.json

Step 2: Add this code in newly created nodemon.json file.

        {
          "ext": "js,json,hbs,html,css"
        }   
Zeeshan Saeed
  • 221
  • 2
  • 4