Gathering detailed insights and metrics for gulp-filter
Gathering detailed insights and metrics for gulp-filter
Gathering detailed insights and metrics for gulp-filter
Gathering detailed insights and metrics for gulp-filter
npm install gulp-filter
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
313 Stars
96 Commits
34 Forks
10 Watchers
1 Branches
14 Contributors
Updated on Jun 01, 2025
Latest Version
9.0.1
Package Id
gulp-filter@9.0.1
Unpacked Size
7.50 kB
Size
3.11 kB
File Count
4
NPM Version
9.2.0
Node Version
18.18.2
Published on
Nov 15, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Filter files in a
vinyl
stream
Enables you to work on a subset of the original files by filtering them using glob patterns. When you're done and want all the original files back, you just use the restore
stream.
1npm install --save-dev gulp-filter
You may want to just filter the stream content:
1import gulp from 'gulp'; 2import uglify from 'gulp-uglify'; 3import filter from 'gulp-filter'; 4 5export default () => { 6 // Create filter instance inside task function 7 const f = filter(['**', '!*src/vendor']); 8 9 return gulp.src('src/**/*.js') 10 // Filter a subset of the files 11 .pipe(f) 12 // Run them through a plugin 13 .pipe(uglify()) 14 .pipe(gulp.dest('dist')); 15};
1import gulp 'gulp'; 2import uglify 'gulp-uglify'; 3import filter 'gulp-filter'; 4 5export default () => { 6 // Create filter instance inside task function 7 const f = filter(['**', '!*src/vendor'], {restore: true}); 8 9 return gulp.src('src/**/*.js') 10 // Filter a subset of the files 11 .pipe(f) 12 // Run them through a plugin 13 .pipe(uglify()) 14 // Bring back the previously filtered out files (optional) 15 .pipe(f.restore) 16 .pipe(gulp.dest('dist')); 17};
By combining and restoring different filters you can process different sets of files with a single pipeline.
1import gulp from 'gulp'; 2import less from 'gulp-less'; 3import concat from 'gulp-concat'; 4import filter from 'gulp-filter'; 5 6export default () => { 7 const jsFilter = filter('**/*.js', {restore: true}); 8 const lessFilter = filter('**/*.less', {restore: true}); 9 10 return gulp.src('assets/**') 11 .pipe(jsFilter) 12 .pipe(concat('bundle.js')) 13 .pipe(jsFilter.restore) 14 .pipe(lessFilter) 15 .pipe(less()) 16 .pipe(lessFilter.restore) 17 .pipe(gulp.dest('out/')); 18};
You can restore filtered files in a different place and use it as a standalone source of files (ReadableStream). Setting the passthrough
option to false
allows you to do so.
1import gulp 'gulp'; 2import uglify 'gulp-uglify'; 3import filter 'gulp-filter'; 4 5export default () => { 6 const f = filter(['**', '!*src/vendor'], {restore: true, passthrough: false}); 7 8 const stream = gulp.src('src/**/*.js') 9 // Filter a subset of the files 10 .pipe(f) 11 // Run them through a plugin 12 .pipe(uglify()) 13 .pipe(gulp.dest('dist')); 14 15 // Use filtered files as a gulp file source 16 f.restore.pipe(gulp.dest('vendor-dist')); 17 18 return stream; 19};
Returns a transform stream with a .restore property.
Type: string | string[] | Function
Accepts a string/array with globbing patterns which are run through multimatch.
If you supply a function, you'll get a vinyl
file object as the first argument and you're expected to return a boolean of whether to include the file:
1filter(file => /unicorns/.test(file.path));
Type: object
Accepts minimatch
options.
Note: Set dot: true
if you need to match files prefixed with a dot, for example, .gitignore
.
Type: boolean
Default: false
Restore filtered files.
Type: boolean
Default: true
When set to true
, filtered files are restored with a stream.PassThrough
, otherwise, when set to false
, filtered files are restored as a stram.Readable
.
When the stream is a stream.Readable
, it ends by itself, but when it's stream.PassThrough
, you are responsible of ending the stream.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More