A Gulp plugin that filters files in a vinyl stream using glob patterns, with optional restoration.
gulp-filter is a Gulp plugin that filters files within a Gulp vinyl stream based on glob patterns or custom functions. It solves the problem of needing to apply transformations to only a subset of files in a pipeline, such as excluding vendor files or processing specific file types, and then optionally restoring the original full stream.
Gulp users and JavaScript developers building complex asset pipelines who need fine-grained control over which files are processed at different stages of their build tasks.
Developers choose gulp-filter for its seamless integration with Gulp's streaming architecture, its ability to temporarily isolate files for processing without losing the original stream, and its support for multiple filters and flexible restoration options within a single pipeline.
Filter files in a vinyl stream
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports glob patterns and custom predicate functions, allowing precise control over which files are included or excluded based on dynamic criteria.
Enables filtered files to be temporarily removed and later restored into the pipeline, preventing duplication and maintaining original file sets with optional passthrough behavior.
Allows combining different filters in a single pipeline, as shown in the README example for processing .js and .less files separately without splitting tasks.
Offers passthrough options to restore filtered files as readable streams or integrate them back, providing flexibility for complex workflow routing.
Only functions within Gulp pipelines, making it useless for projects migrating to or using alternative build tools like esbuild or Parcel.
Overusing multiple filters and restores can lead to convoluted, hard-to-debug code, especially in large tasks with nested conditional processing.
Filtering and restoring streams may introduce latency in builds with thousands of files, as each filter operation adds processing steps to the vinyl stream.