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


基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01