express-live-reloading
Version:
Live reloading middleware express
15 lines (10 loc) • 362 B
JavaScript
const chokidar = require('chokidar') ;
module.exports = function( path2watch ) {
const watcher = chokidar.watch( path2watch ) ;
const {reloadEmitter} = process.liveReload ;
watcher
.on('change' , () => reloadEmitter.emit('reload') )
.on('unlink' , () => reloadEmitter.emit('reload') )
;
return watcher ;
} ;