A gulp plugin for embedding a livereload snippet into html files
Plugin for embedding a livereload snippet in html files for gulp
gulp-embedlr as a development dependency:
npm install --save-dev gulp-embedlr
Then, add it to your
var embedlr = require"gulp-embedlr";gulpsrc"./src/*.html"pipeembedlrpipegulpdest"./dist";
Port where the script is loaded.
"' + (location.protocol || 'http:') + '//' + (location.hostname || 'localhost') + ':" + port + "/livereload.js?snipver=1";
The source of the livereload script provided (not by gulp-embedlr). Normally you would not need to change this, only when serving livereload with a proxy for instance.
This modifies the original html-file by embedding the livereload-snippet, therefore you should not pipe it back into the same directory where you keep the original files.
Alone, this plugin does not really do much interesting stuff, but combined with gulp-livereload and a static server you get a neat workflow.