-
Notifications
You must be signed in to change notification settings - Fork 17
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
Auto Subsetting #37
Comments
It's been asked before and I'm hesitant to bake something like this in as I would prefer to keep dependencies & bloat to a minimum. I'll look into some options and see what it may take. I think another package that handles that functionality in the form of a script or Webpack plugin (or both in that package) that parses source files via globs and simply passes them to this package would be preferred. |
@samjonesigd I actually took a stab at that a few years ago for our websites. Here's what I came up with: It's pretty simple in concept. Basically, it scans target directories for code that references font awesome files and builds out a config for "fontawesome-subset" by pairing Config basically looks like this: // Import fontawesome-scraper
import iconScraper from '@cremadesign/fontawesome-scraper';
// Grab icons asynchronously from a list of folders
var icons = await iconScraper({
folders: [
'www'
]
});
// Do something with the final results!
console.log(icons); And it'll export a "icons.json" file that "fontawesome-subset" can work with: {
"solid": [
"arrow-right",
"asterisk",
"ban",
"exclamation-circle",
"sync",
"tools"
],
"brands": [
"github"
],
"regular": [
"arrow-left",
"home",
"sync"
]
} |
Could you add a way to make the src directories or files instead of manually adding your icon names?
On a big project this is quite difficult to maintain currently
The text was updated successfully, but these errors were encountered: