Search code examples
javascriptgulpgulp-notify

Calling gulp-notify without using .pipe()


In my gulpfile.js I have a task that calls two other tasks. When the previous tasks have run, a notification should be triggered.

var notify = require('gulp-notify');

gulp.task('build', ['build:js', 'build:css'], function() {
  console.log('hello', arguments);
  gulp.src('gulpfile.js').pipe( notify({ title: 'Production Build', message: 'Done' }) );
});

Is there a way to trigger notify without calling gulp.src('gulpfile.js').pipe( first? While not a real problem, this approach feels unnecessary to me. It is entirely possible that my question results from an insufficient understanding of gulp. So feel free to point me to any misunderstanding.


Solution

  • You can use node-notifier directly:

    var notifier = require('node-notifier');
    
    gulp.task('build', ['build:js', 'build:css'], function() {
        notifier.notify({ title: 'Production Build', message: 'Done' });
    });