node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

views-auto-reload

express-views-auto-reload

a express middleware that can auto reflush your web page when the files changed

install

npm install views-auto-reload --save-dev

use
import express from 'express'
import autoreload from 'views-auto-reload'
 
let app = express()
 
app.set('views', path.join(__dirname, 'views'))  //set you own view path
app.set('view engine', 'jade')  //set you own view engine
 
app.use(autoreload(app, {suffix: ['.jade']}))
 
app.get('/', (req, res) => {
  // the auto-reload will overwrite the render function
  // when the hello.jade change, the client brower will execute 'location.reload()' function
  res.render('hello.jade')
})
....
....