I am getting into the many streams of Gulp and have run across a confounding subject. I'd like to post a notification when all the tasks are actually complete. I see that the tasks are executed but running asynchronously by default.
What if I want to show display a notification after each step is complete...and at the end when all steps are complete?
What is the best way to gain more control over the timing of tasks in gulp?
Currently, I'm using gulp-notify to display notifications.
UPDATE X 2
I'm not really having any errors, but would like to better understand the order of operations here and how I can trigger my own notification of when all tasks have been complete. Here is the example.
var gulp = require('gulp'),
gp_concat = require('gulp-concat'),
gp_notify = require('gulp-notify');
gulp.task('task1', function() {
return gulp.src(['file1.js','file2.js'])
.pipe(gp_concat('file1_2.js')
.pipe(gp_notify({ message: "file1_2 created." }
})
gulp.task('task2', function() {
return gulp.src(['file3.js','file4.js'])
.pipe(gp_concat('file3_4.js')
.pipe(gp_notify({ message: "file3_4 created." }
})
gulp.task('mainTask', ['task1','task2'], function() {
gulp.src('file*_*.js')
.pipe(gp_notify({ message: "All tasks complete." }))
});
In the console, the notifications are now timed correctly, however at the end of the execution, right before Finished 'mainTask' after xx ms the final 'All tasks complete' message fires off [n-1] times, where n is the count of sub tasks.
What is causing this final notification to get triggered so many times and how can that be suppressed?