Calling gulp-notify without using .pipe()(在不使用 .pipe() 的情况下调用 gulp-notify)
问题描述
在我的 gulpfile.js
中,我有一个调用另外两个任务的任务.当之前的任务已经运行时,应该会触发一个通知.
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' }) );
});
有没有办法在不调用 gulp.src('gulpfile.js').pipe(
的情况下触发通知?虽然不是一个真正的问题,但这种方法对我来说没有必要.完全是可能我的问题是由于对 gulp 的理解不足造成的.所以请随时指出我的任何误解.
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.
推荐答案
可以直接使用node-notifier:
var notifier = require('node-notifier');
gulp.task('build', ['build:js', 'build:css'], function() {
notifier.notify({ title: 'Production Build', message: 'Done' });
});
这篇关于在不使用 .pipe() 的情况下调用 gulp-notify的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在不使用 .pipe() 的情况下调用 gulp-notify


- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01