-
Notifications
You must be signed in to change notification settings - Fork 103
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
Support filtering files by extension #145
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
@mcollina Sure, I should be able to take a first stab. Quick question, did you have a preference for the implementation? The most flexible/generic approach would likely be supporting a filter function that would accept the URL/filename and return a boolean. This would allow users to put as simple or as complex of logic as they want. Let me know your recommendation and I can work on getting something written. Thanks. |
A filter function would be great. |
I just realized you could pass a glob to the Can you confirm if my understanding of how the wildcard/glob works? |
Yes, it should work the way you assume. |
TLDR use allowedPath: (pathName) => {
if (environmentIsProduction) {
return !pathName.includes('.map');
}
return true;
}, |
🚀 Feature Proposal
Support filtering files by extension.
Motivation
Sometimes you may want to keep your JavaScript or CSS files alongside a component. For those not using build steps, it'd be great to have the ability to filter what files to serve by pointing
root
at the directory, but only serving certain files based off extension (or more generically could be pattern matching in general).Example
Assume we have the following directory structure:
We'd register our plugin like so (assume PWD is
src
):Example of general pattern instead:
Examples of access:
The text was updated successfully, but these errors were encountered: