gulp.task('sync', function (cb) { // setTimeout setTimeout(function () { cb(); }, 1000); }); gulp.task('sync', function () { return gulp.src('js/*.js') .pipe(concat('script.min.js') .pipe(uglify()) .pipe(gulp.dest('../dist/js'); }); gulp.task('sync', function () { var deferred = Q.defer(); // setTimeout setTimeout(function () { deferred.resolve(); }, 1000); return deferred.promise; }); secondTask task, which depends on the results of the sync task (which we created in one of the ways described above). Therefore, we declare our sync task as a dependency for the secondTask task: gulp.task('secondTask', ['sync'], function () { // // 'sync' ! }); gulp.task('thirdTask', function () { // }); // , // 'sync', // 'thridTask' // 'default'. . // 'default', // 'sync' 'thridTask // gulp.task('default', ['sync', 'thirdTask'], function () { // - }); default task to be executed in the order I wanted, the thirdTask task thirdTask be made dependent on the sync task. gulp.task('thirdTask', ['sync'] function () { // 'sync'. // , 'default' // , 'thirdTask' }); gulp.task('default', ['sync', 'thirdTask'], function () { // - }); thirdTask , sync will also be run. This may be an undesirable behavior if you have some watch task that runs the thirdTask task.Source: https://habr.com/ru/post/240485/
All Articles