gulp-filter-each
Filter files from a Gulp stream based on their content or filepath.
Install
npm install gulp-filter-each
Usage
Pass a function to the plugin, which takes three possible arguments:
- content - contents of the file as readable string (UTF8)
- filepath - path/filename of the file
- done - callback to be used for async operation
Return a truthy/falsy value to filter files in the stream:
true
(or truthy) to include the filefalse
(or falsy) to exclude the file
Use for both sync or async operations:
- sync - simply return a value (see examples below)
- async - accept a third argument which is a callback to call when done (see examples below)
Examples
const gulp = const filter = gulp gulp gulp gulp