Reputation: 75844
is there anything like nodemon that works on .ejs file changes?
nodemon will detect changes in .js or .coffee files and restart your node app. But it won't detect changes to view files. I've emailed author, but they are unresponsive.
Upvotes: 26
Views: 24412
Reputation: 1424
If you are using Node.js v18 or higher, you can stop using nodemon and just pass the --watch
flag to the node
command:
node --watch index.js
The option is still experimental, but it works fine most of the time.
Upvotes: 4
Reputation: 49
Just make sure your NODE_ENV=development and use nodemon. It works
Upvotes: 0
Reputation: 876
You can use supervisor. https://github.com/isaacs/node-supervisor or npm install supervisor -g
If you need to watch certain files, you just update the -e argument. So you would run something similar to
supervisor -e 'js|ejs|node|coffee' app.js
Upvotes: 20
Reputation: 4631
Maybe this wasn't implemented when you posted the question, but you simply pass the option
-e coffee,js,ejs
See the docs: https://github.com/remy/nodemon
supervisor
is an alternative, but when I last used it, it was eating CPU. That may have been fixed by now, but I'd stick with nodemon
.
Upvotes: 43
Reputation: 2834
use this in your packages.json
"scripts":{
"start":"nodemon -e js,ejs,html -w . -w public -w views -w routes -w models server.js"
}
Supervisor constantly eats ~20% of my CPU
Upvotes: 11
Reputation: 26219
watch
option) and several times faster than EJS and many others.Upvotes: 1