CNode

新人求教关于gulp的问题

Bbigbig-orange发布于12 年前最后回复12 年前4 回复4219 浏览0 收藏

最近在用gulp构建前端代码,遇到一个问题 gulp.task('imagemin', function () { gulp.src('./static/**/img/*') .pipe(imagemin({ progressive: true })) .pipe(gulp.dest('./dist/image')) .pipe(notify({ message: 'Images task complete' })); }); 这样我每压缩一张图片就会给出一个提示,我想让图片全部压缩完成之后给一个通知就行 请问应该如何做到?

查看回复

回复 (4)

F
fundon#1·12 年前

https://github.com/mikaelbr/gulp-notify 看文档呀

options.onLast

Type: Boolean Default: false
If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file.
R
ringtail#2·12 年前

.pipe(notify({ message: 'Images task complete' }));这个造成的。

B
bigbig-orange#3·12 年前
引用 fundonhttps://github.com/mikaelbr/gulp notify 看文档呀

谢谢,成功了我以为是通过gulp的api控制呢给notify自身的忽略了

B
bigbig-orange#4·12 年前
引用 ringtail.pipe(notify({ message: 'Images task complete' }));这个造成的。

嗯,知道是这一句,楼上是答案了,也谢谢你

参与回复
登录后即可参与回复。登录