gulp-embedlr

A gulp plugin for embedding a livereload snippet into html files

npm install gulp-embedlr
25 downloads in the last day
138 downloads in the last week
672 downloads in the last month

gulp-embedlr NPM version Build Status Dependency Status

Plugin for embedding a livereload snippet in html files for gulp

Usage

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"));

API

embedlr(options)

options.port

Type: String|Number

Default: 35729

Port where the script is loaded.

options.src

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.

Usage

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.

License

MIT License

npm loves you