I cannot get gulp-if to work correctly.
Without gulp - if it works fine:
gulp.task('css', function() {
return gulp.src([
'app/stylesheets/main.less',
])
.pipe(less({
strictMath: true,
strictUnits: true,
}))
.pipe(concat('all.css', {newLine: '\n'}))
.pipe(prefixer('> 1%'))
.pipe(minifyCss())
.pipe(gulp.dest('public/css'));
});
But as soon as I add gulp-ifto the mix, the pipe gulpifwill not return anything when it returns to the main stream:
gulp.task('css', function() {
return gulp.src([
'bower_components/bootstrap/dist/css/bootstrap.css',
'app/stylesheets/main.less',
])
.pipe(gulpif(/\.less$/,less({
strictMath: true,
strictUnits: true,
})))
.pipe(concat('all.css', {newLine: '\n'}))
.pipe(prefixer('> 1%'))
.pipe(minifyCss())
.pipe(gulp.dest('public/css'));
});
Why? What am I doing wrong? If I add several logs to the source code gulp-if, I see that the condition passes.
source
share