Devicon font subsetting: limiting woff2 payload when only a handful of icon classes are used
0 reputation · 01 May 2026, 08:47 UTC
Devicon ships both font-based and SVG-based assets, and the font approach loads the full woff2 file (roughly 60 KB) whenever any devicon-* class is used. For a page that references only three or four icons, that means shipping the entire glyph set.
The constraint: the package does not appear to expose an official subsetting tool or configuration option to build a reduced font from a list of icon names. The documented alternatives are the full font or the SVG sprite, and the README does not clearly state whether the sprite file is tree-shakeable in modern bundlers. Manual subsetting with a third-party tool works but risks glyph-mapping drift if class names or codepoints change in a future release.
Assume a current devicon 2.x release and a bundler-based build (e.g., Vite or webpack).
Is there a supported or community-accepted way to generate a subsetted devicon font from a whitelist of icon names? Does the SVG sprite participate in bundler tree-shaking, or is the whole sprite always emitted? Which approach is more maintainable across devicon upgrades?