sindresorhus / gulp-filter

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

Use matchBase to filter by resource type #6

Closed duncanbeevers closed 10 years ago

duncanbeevers commented 10 years ago

I'm using gulp-bower-files to get access to all my vendored assets. I'd like to partition them by file type.

I propose this

bowerFiles().pipe(filter('*.js'))

rather than

bowerFiles().pipe(filter('**/*.js'))
sindresorhus commented 10 years ago

@mariocasciaro @adam-lynch any thoughts on this?

mariocasciaro commented 10 years ago

Why don't just expose it as an option?

sindresorhus commented 10 years ago

Yeah, could probably just expose the minimatch options. Though, should matchBase be on by default? I know I want dot to be.

mariocasciaro commented 10 years ago

I think it's more intuitive for the user if we just keep minimatch default behavior, which is well known, instead of documenting what are the options enabled by default in gulp-filter. I vote for having matchBase disabled by default as it is in minimatch.

sindresorhus commented 10 years ago

@mariocasciaro agreed

duncanbeevers commented 10 years ago

Okie dokie.

sindresorhus commented 10 years ago

@duncanbeevers would you like to implement the change? Just do the change and force push to this remote branch to update the PR ;)

duncanbeevers commented 10 years ago

I'd be happy. Let me see if I can carve out some time today or tomorrow while traveling to knock it out.

duncanbeevers commented 10 years ago

It looks like the current implementation uses the non-default option dot: true. Do you want to preserve this behavior or make the options perfectly symmetrical?

duncanbeevers commented 10 years ago

I left it as simple as possible, threading options through to multimatch. This is a potentially-breaking change to some builds.

sindresorhus commented 10 years ago

@duncanbeevers mind adding a short note about people having to use dot: true for it to accept files with leading dot?

duncanbeevers commented 10 years ago

Updated tests. Added options description to Readme. Added explicit note about dot: true behavior.

sindresorhus commented 10 years ago

Looking good. Thanks :)