patrickhulce / fontmin-webpack

Minifies icon fonts to just the used glyphs.
MIT License
139 stars 19 forks source link

Allow to filter optimized fonts with an allowlist and a skiplist #48

Closed Moustachos closed 2 years ago

Moustachos commented 2 years ago

Add two options: allowedFilesRegex & skippedFilesRegex.

Both can be null or RegExp, they're mutually exclusive and allowedFilesRegex has priority over skippedFilesRegex.

Usage example (to only target FontAwesome):

const FontminPlugin = require('fontmin-webpack')

Encore
  .addPlugin(new FontminPlugin({
    allowedFilesRegex: /^fa-/
  }))

Fix https://github.com/patrickhulce/fontmin-webpack/issues/29 Fix https://github.com/patrickhulce/fontmin-webpack/issues/5

Moustachos commented 2 years ago

There you go :)

patrickhulce commented 2 years ago

thanks @Moustachos !

patrickhulce commented 2 years ago

heads up @Moustachos we have a lint failure, but LGTM other than that

Moustachos commented 2 years ago

@patrickhulce it should be fixed now

Moustachos commented 2 years ago

@patrickhulce could you merge this one when you got some time?

I also made a pull request on Fontmin lib to address a bug where invalid code points are pushed to output, due to of how code points uniqueness is checked (https://github.com/ecomfe/fontmin/pull/92).

It's been merged in 0.9.9 so if you could upgrade it while you're at it, it would be sweet 👍

patrickhulce commented 2 years ago

thanks for the ping @Moustachos!