0.0.0 • Published 10 years ago

gulp-express2 v0.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

gulp-express2

improved version of gulp-express

npm install --save-dev gulp-express2

Example

Express

var express = require('express');
var livereload = require('connect-livereload');
var app = express();
app.use(livereload({ port: 35729 }));
// ...

gulpfile

gulp.task('watch', function () {
  var gutil = require('gulp/node_modules/gulp-util');
  var errLogger = function () {
    gutil.log(gutil.colors.red.apply(undefined, arguments));
  };
  var app = require('gulp-express2')('app.js', gutil.log, errLogger);

  // app.env = 'development';
  // app.port = 35729;

  app.run();

  gulp.watch([
    'app.js'
  ]).on('change', function (file) {
    app.run();
    setTimeout(function () {
      app.notify(file);
    }, 1000);
  });

  gulp.watch([
    'assets/**/*.js'
  ]).on('change', function (file) {
    gulp.start('scripts');
    app.notify(file);
  });

  gulp.watch([
    'assets/**/*.less'
  ]).on('change', function (file) {
    gulp.start('less');
    app.notify(file);
  });
});