sindresorhus / gulp-filter

Filter files in a `vinyl` stream
MIT License
315 stars 37 forks source link

Is that possible to filter stream after changed it? #93

Open Scorpovi4 opened 4 years ago

Scorpovi4 commented 4 years ago

I'm using template convertation from ejs to html and want to filter some files which have been converted from ejs to html but didn't transfer to the next gulp task.

gulp.task('ejs', () => {
    const exceptions = filter(['**', '!**/_pages/modals/**/*.html'], {
      restore: true,
    });
    return gulp
      .src($.srcFolder + 'ejs/_pages/**/*.ejs')
      .pipe(
        plumber({
          errorHandler: notify.onError('Error: <%= error.message %>'),
        })
      )
      .pipe($.cached('ejs'))
      .pipe(ejs().on('error', ejs.preventCrash))
      .pipe(debug())
      .pipe(exceptions)
      .pipe(htmlValidator())
      .pipe(htmlValidator.reporter())
      .pipe(exceptions.restore)
      .pipe(gulp.dest($.distHtml));
  });