I'm new to Gulp (and not very comfortable with js). When I use
gulp.task('sass', function () {
gulp
.src('myfile.scss')
.pipe(sourcemaps.init())
.pipe(sass(myoptions))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('mypath'))
.pipe(browserSync.stream({match: '**/*.css'}));
});
compilation is made in a few ms
But When i use
gulp.task('sass', function () {
return gulp
...
});
it take several seconds to compile.
Can someone explain me why ?
Thanks.
Gulp uses orchestrator to execute the tasks. Your task returns a promise or a stream (in your case it's a stream), which is used for sequencing.
When you return nothing, the caller can't know that your task isn't finished, which has at least 2 impacts: