Rollup plugin for LiveReload that watches the bundle and reloads the page on change
npm install rollup-plugin-livereload```
npm install --save-dev rollup-plugin-livereload
`js
// rollup.config.js
import livereload from 'rollup-plugin-livereload'
export default {
entry: 'entry.js',
dest: 'bundle.js',
plugins: [livereload()],
}
`
To make it a real dev-server, combine this plugin with [rollup-plugin-serve].
`js
// rollup.config.js
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'
export default {
entry: 'entry.js',
dest: 'bundle.js',
plugins: [
serve(), // index.html should be in root of project
livereload(),
],
}
`
By default, it watches the current directory. If you also have css output, pass the folder to which the build files are written.
`
livereload('dist')
// --- OR ---
livereload({
watch: 'dist',
verbose: false, // Disable console output
// other livereload options
port: 12345,
delay: 300,
https: {
key: fs.readFileSync('keys/agent2-key.pem'),
cert: fs.readFileSync('keys/agent2-cert.pem')
}
})
`
Options are always passed to [livereload.createServer()][livereload]
Please see CHANGELOG for more information what has changed recently.
Contributions and feedback are very welcome.
To get it running:
1. Clone the project.
2. npm installnpm run build`
3.
- Thomas Ghysels
- [All Contributors][link-contributors]
The MIT License (MIT). Please see License File for more information.
[link-author]: https://github.com/thgh
[link-contributors]: ../../contributors
[livereload]: https://www.npmjs.com/package/livereload
[rollup-plugin-serve]: https://www.npmjs.com/package/rollup-plugin-serve