Calling gulp-notify without using .pipe()

2019-03-14 18:09发布

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.

1条回答
走好不送
2楼-- · 2019-03-14 18:40

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' });
});
查看更多
登录 后发表回答