All we need to do is to use a stream as the return of the task definition function. This is simple because the pipe operator returns a stream:
gulp.task("sync", function () { return gulp.src([ "src/**/**.ts" ]) .pipe(somePlugin({})) .pipe(somePlugin ()); });
Now that we have some synchronous tasks, we can use them as a subtask of a new task named async:
gulp.task("async", ["sync1", "sync2"], function () { // This task will not start until // the sync tasks are completed! console.log("Done!"); });
As we can see in the preceding code snippet, it is also possible to define a task that has some subtasks. However, if the complexity of our build process increases, we can end up with a very difficult to follow task dependency ...