gulp-grep-contents

Filter a gulp stream by file contents

Usage no npm install needed!

<script type="module">
  import gulpGrepContents from 'https://cdn.skypack.dev/gulp-grep-contents';
</script>

README

gulp-grep-contents

Gulp plugin for filtering files based on a regular expression matching their contents.

Usage

var grepContents = require('gulp-grep-contents');

gulp.src(['./templates/*.hbs'])
  .pipe(grepContents(/<head>/))
  .pipe(gulp.dest('./headers'));

Inverted

var grepContents = require('gulp-grep-contents');

gulp.src(['./templates/*.hbs'])
  .pipe(grepContents(/<head>/, {inverted: true}))
  .pipe(gulp.dest('./body'));