Search code examples
node.jsnodemon

Nodemon not effect of the nunjucks file


I install the nodemon for my node project.

And I use "--watch app" command to watch the file change.

When I modify other files, it works well, I can see the auto restart log on the screen ( Windows powershell ).

However, when I modify the template engine file (path: app/view/index.nj), they do not restart automaticlly.

How to resolve this problem?

Here is a part of "package.json" file

    "scripts": {
    "dev": "nodemon --watch app --ignore app/static/css --ignore app/static/js ./dev.js"
  }

Solution

  • Nodemon only restarts if .js and .coffee files are changed by default. You have to pass the extension to the nodemon.

    "scripts": {
        "dev": "nodemon -e js,html,nj --watch app --ignore app/static/css --ignore app/static/js ./dev.js"
    }