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
基础教程推荐
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01