build - Gulp task runs much faster without 'return' statement - why is that? -
gulp task formed (without return
) runs faster:
gulp.task('less', function () { gulp.src('./less/**/*.less') .pipe(less()) .pipe(gulp.dest('./destination')); });
than same 1 return
:
gulp.task('less', function () { return gulp.src('./less/**/*.less') .pipe(less()) .pipe(gulp.dest('./destination')); });
so, question gulp task supposed return
? why faster without return
, while still generates expected files?
after investigation found when return
used on gulp task it's not slower @ all, returns correct time took finish task.
it felt faster since without return
statement returned result completed instantly, task time looked few ms, actual process continued on background , completed silently.
so, it's safe it's prefferable use return
on tasks have gulp.src()
.
Comments
Post a Comment