gulp plugin for express
Switch branches/tags
Nothing to show
Clone or download
ccyu 0.3.6
Latest commit 2d47fbe Jul 29, 2015
Failed to load latest commit information.
test add dummy test Mar 5, 2015
.gitignore Return child process object from run() Oct 22, 2014
.travis.yml add travis Mar 4, 2015 correct link for new package Mar 19, 2015
index.js Change server_ENV to NODE_ENV Jul 28, 2015
package.json 0.3.6 Jul 29, 2015

please use gulp-live-server instead, it's a new version of gulp-express with a better name and new features.

Build Status Livereload downloads Tag MIT Licensed

A gulp plugin which serve the app with livereload, internally, it does the following:



Update notice

  • v0.3.0

    change signature of the third param livereload is used to config tiny-lr server.

  • v0.2.0

    get console.log back.

  • v0.1.12 is used for creating tiny-lr server. options here is the second parameter for

  • v0.1.7

    change signature for, split options into args and options.

  • v0.1.5

    pipe support added for server.notify


Run/re-run the script file, which will create a http(s) server.

Start a livereload(tiny-lr) server if it's not started yet.

Use the same arguments with ChildProcess.spawn with 'node' as command.

  • args - Array - Array List of string arguments. The default value is ['app.js'].
  • options - Object - The third parameter for ChildProcess.spawn, the default value is:
options = {
    cwd: undefined
options.env = process.env;
options.env.NODE_ENV = 'development';
  • livereload - Boolean|Number|Object - The option for tiny-lr server. The default value is 35729.
    • false - will disable tiny-lr livereload server.
    • number - treated as port number of livereload server.
    • object - used to create tiny-lr server new tinylr.Server(livereload);.
  • Returns a ChildProcess instance of spawned server.


Stop the instantiated spawned server programmatically, and the tiny-lr server.


Send a notification to the tiny-lr server in order to trigger a reload on page. pipe support is added after v0.1.5, so you can also do this:

  • event (required when server.notify is invoked without pipe) - Object - Event object that is normally passed to callback. Should contain path property with changed file path.


// gulpfile.js
var gulp = require('gulp');
var server = require('gulp-express');

gulp.task('server', function () {
    // Start the server at the beginning of the task['app.js']);

    // Restart the server when file changes['app/**/*.html'], server.notify);['app/styles/**/*.scss'], ['styles:scss']);
    //['{.tmp,app}/styles/**/*.css'], ['styles:css', server.notify]);
    //Event object won't pass down to's callback if there's more than one of them.
    //So the correct way to use server.notify is as following:['{.tmp,app}/styles/**/*.css'], function(event){'styles:css');
        //pipe support is added for server.notify since v0.1.5,
    });['app/scripts/**/*.js'], ['jshint']);['app/images/**/*'], server.notify);['app.js', 'routes/**/*.js'], []);
// app.js
var express = require('express');
var app = = = express();

//you won't need 'connect-livereload' if you have livereload plugin for your browser