Closed RentecTravis closed 3 years ago
I think this exists a little outside the scope of this project, but if you were willing to put it up as a gist or something I think it could probably be linked to for inspiration as it's definitely a good idea if their codebase were to support it.
I'm using your library (THANK YOU!) and made a script so that in dev we could use the regular fontawesome without having to worry about which icons are or aren't in the subset, and when we build the script discovers all the icons in use and auto-generates a subset.
I think with some improvements could be valuable to anyone who uses this project. Namely, the fact that
grep
isn't available on all systems should be accounted for.Script
fa-subset.zip
Since you can't do conditional imports in SCSS, in dev mode we generate a file that just includes the fontawesome lib as normal.
In prod the generated SCSS file references the subsetted font files.
package.json
scriptsWe use Webpack Encore so something like this worked for us
In SCSS