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

Add fontRegex configuration option #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Moustachos
Copy link
Contributor

Add fontRegex option to control which file types should be processed by fontmin.

Default value: FONT_REGEX.

I didn't write any test for this because it doesn't change anything on lib behavior, it just adds more room for fine-tuning.

For example, in a project I have many SVG logos, but no SVG fonts, so it doesn't make much sense to try and find glyphs in these files.

With this option we can define which file types must be parsed at a project level :)

@patrickhulce
Copy link
Owner

Thanks for the contribution!

I didn't write any test for this because it doesn't change anything on lib behavior, it just adds more room for fine-tuning.

Test can be added that leverages this fine-tuning :) At the moment I'm not sure how this is useful, if we're picking up non-font SVGs in a way that generates bad output, that's a bug we should fix separately!

@Moustachos
Copy link
Contributor Author

You're welcome!

In fact, I needed this feature in my project because I copy these SVG logos from my assets directory to my build directory using Webpack's .copyFiles() method.

It worked just fine on v3.2.0, but since #59 merge I get an error at this line: https://github.com/patrickhulce/fontmin-webpack/blob/master/lib/index.js#L93

The error was something like:
Error: ENOENT: no such file or directory, open 'images/my-logo.svg'

The image exists, I didn't quite get why it used to work just fine before and removing svg from FONT_REGEX fixed my issue, so I came up with this PR.

But if you got a way to fix this error without my PR, it would be even better :)

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

Successfully merging this pull request may close these issues.

2 participants