gulp-wait
A gulp task that inserts a delay before calling the next function in a chain.
Last updated 7 years ago by bpartridge83 .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-wait 
SYNC missed versions from official npm registry.

gulp-wait

A gulp task that inserts a delay before calling the next function in a chain.

Example

The following example will watch for changes to templates and delay the livereload server refresh until after the nodemon script is expected to have restarted.

// Gulpfile.js
var gulp = require('gulp')
  , r = require('tiny-lr')
  , refresh = require('gulp-livereload')
  , nodemon = require('gulp-nodemon')
  , wait = require('../gulp-wait')
  , server = lr();

gulp.task('dev', function () {

  gulp.src('./index.js')
    .pipe(nodemon());

  server.listen(35729, function (err) {

  	if (err) return console.log(err);

  	gulp.watch('./app/views/**/*.html', function (e) {
      gulp.src(e.path)
        .pipe(wait(1500))
        .pipe(refresh(server));
    });

  });

})

Yes, ideally there would be an event from nodemon to trigger the livereload.

Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago

Copyright 2014 - 2016 © taobao.org |