views-auto-reload
v1.0.11
Published
a express middleware that can auto reflush your web page when the files changed
Downloads
5
Maintainers
Readme
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')
})
....
....