Skip to content

Use gulp-if instead of gulp-filter #1

@yocontra

Description

@yocontra
gulp.task('sometask', function () {
    var jsFilter = $.filter('**/*.js');
    return gulp.src('app/*.html')
      .pipe(jsFilter)
      .pipe(uglify())
      .pipe(jsFilter.restore())
      .pipe(otherstuff)
      .pipe(gulp.dest('stuff'))
});

becomes

gulp.task('sometask', function () {
    return gulp.src('app/*.html')
      .pipe(gif('*.js', uglify()))
      .pipe(otherstuff)
      .pipe(gulp.dest('stuff'))
});

gulp-if provides a nice way to apply portions of the pipeline only when the file matches a regex, function, glob, boolean, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions