Niall O'Brien Niall O'Brien - 1 year ago 135
Javascript Question

Sails.js, Nunjucks & LiveReload

I've managed to get Nunjucks working with Sails.js, however it seems that the changes are not being picked up until I restart the server. I'll automatically see the changes reflected once or twice, but after that, even manually refreshing the browser will not show my changes.

I implemented LiveReload with the advice here: Get livereload to work with Sails.js but I don't suspect it's an issue with LiveReload.

Has anyone else gotten Sails.js and Nunjucks to play nicely together? If so, how?

Thanks in advance.

Answer Source

I hope you see this answer.

The Problem is nunjucks himself have a watch option, this option is by default to false:

what you can do is, in sails/config/bootstrap.js

var nunjucks = require('nunjucks')
 module.exports.bootstrap = function(cb) {

  // It's very important to trigger this callback method when you are finished
  // with the bootstrap!  (otherwise your server will never lift, since it's waiting on the bootstrap)

in combination with the livereload works all fine.