How to setup nodemon with Apostrophe CMS 2?

254 views Asked by At

Trying to make development with Apostrophe smoother. Running nodemon with app.js and although nodemon detects changes it does not restart the server and i get [nodemon] changes after filters (before/after): 1/0 from Nodemon. I understand that Apostrophe does some asset auto generation. What's the best way to setup Nodemon to watch for changes?

2

There are 2 answers

0
Kiril Okun On

Turned out that nodemon does not watch .html files by default. Here's a nodemon.json file that works for me:

{ "restartable": "rs", "verbose": true, "env": { "NODE_ENV": "development" }, "ignore": [ ".git", "node_modules/*" ], "watch": [ "lib" ], "ext": "js html json" }

0
Carsten On

A bit late but we added support for nodemon in Apostrophe 2. Check it out:

Adds nodemonConfig and Prevent restarting of nodemon in some edge cases.

As you can see, this is part of the boilerplate. Each apos create-project using apostrophe-cli will add that config to your package.json. But you could easily add this to your existing projects, of course.

Let us know about any unexpected behavior.