Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple patterns #2

Closed
rubennorte opened this issue Aug 20, 2015 · 6 comments
Closed

Allow multiple patterns #2

rubennorte opened this issue Aug 20, 2015 · 6 comments

Comments

@rubennorte
Copy link

Right now we can only use a single pattern to detect unused files:

new UnusedFilesWebpackPlugin({
  pattern: 'js/src/**'
})

It would be nice if we could set an array of patterns. That way we could check if all files in src and certain files in the test directory, for example, are used or not:

new UnusedFilesWebpackPlugin({
  patterns: [
    'js/src/**',
    'js/test/support/**',
    'js/test/specs/**'
})

I think it would be as easy as replace glob with multi-glob

@tomchentw
Copy link
Owner

Good idea!

@mattdell
Copy link

mattdell commented Jul 4, 2016

Agreed it would be much easier, but if you're stuck with this you can still do it with the current syntax:

In my solution I've done this:

new UnusedFilesWebpackPlugin({
    pattern: '+(lib|assets)/**/*.*'
}),

See syntax here: https://github.com/isaacs/node-glob#glob-primer

@tomchentw
Copy link
Owner

Any suggested libraries for multiple glob patterns?

@QWp6t
Copy link

QWp6t commented Sep 28, 2016

@tomchentw glob-all - https://www.npmjs.com/package/glob-all

In a similar plugin I wrote, I was able to use glob-all as a drop-in replacement for glob. I think it also accepts both strings and arrays. You could try it and see if it passes your current tests.

@tomchentw
Copy link
Owner

@QWp6t thanks! This looks interesting

tomchentw added a commit that referenced this issue Oct 23, 2017
@tomchentw
Copy link
Owner

Released v3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants