gulp-embedlr

A gulp plugin for embedding a livereload snippet into html files

gulp-embedlr

Plugin for embedding a livereload snippet in html files for gulp

First, install gulp-embedlr as a development dependency:

npm install --save-dev gulp-embedlr

Then, add it to your gulpfile.js:

var embedlr = require("gulp-embedlr");
 
gulp.src("./src/*.html")
    .pipe(embedlr())
    .pipe(gulp.dest("./dist"));

Type: String|Number

Default: 35729

Port where the script is loaded.

Type: String

Default: "' + (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.

This plugin is meant as an alternative to the connect-livereload middleware or a browser plugin. For example with a simpler static server like ecstatic or simply python -m SimpleHTTPServer.

MIT License