Gulp condition inside pipe

Use the gulp-if plugin:

var gulpif = require('gulp-if');

g.task('sass', function() {
    return g.src(sources.sass)
        .pipe(changed(output.css))
        .pipe(sass({style:'compressed', sourcemap:true}))

        // Conditional output
        .pipe(gulpif(condition1, g.dest(output.css)))
        .pipe(gulpif(condition2, g.dest(output.css2)))

        .pipe(notify('scss converted to css and compressed <%= file.relative %>'));
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)