Giter Club home page Giter Club logo

gulp-embedlr's Introduction

gulp-embedlr NPM version Build Status Dependency Status

Plugin for embedding a livereload snippet in 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 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.

A complete example using embedlr is available here.

License

MIT License

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.