views-auto-reload

1.0.11 • Public • Published

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')
})
....
....

Dependencies (2)

Dev Dependencies (3)

Package Sidebar

Install

npm i views-auto-reload

Weekly Downloads

0

Version

1.0.11

License

Apache-2.0

Last publish

Collaborators

  • diamondfsd