Most frontend teams treat icons as an afterthought. You need a hamburger menu icon, you npm install an icon library, and move on. Six months later your bundle analyzer shows 340KB of icon font or sprite data you're using maybe 4% of, and nobody remembers why.
This isn't a "here's what SVG is" post. If you're reading dev.to, you already know SVGs beat icon fonts and PNGs on scalability, accessibility, and file size. What I want to talk about is the workflow mistake almost every team makes with icons — and how to actually fix it.
The real problem: icon libraries are import-all by default
Most popular icon packages ship as a single package with hundreds or thousands of components. Tree-shaking is supposed to save you, but in practice:
Barrel file exports (export * from './icons') defeat tree-shaking in a lot of bundlers unless you're extremely careful with your build config
Icon fonts (still shockingly common) load the entire glyph set even if you use six icons
Base64-inlined SVGs in JS bundle the icon markup into your JS payload, which means it's parsed, not just downloaded
The fix isn't "use SVG instead of icon fonts" — you probably already do that. The fix is treating icons as assets to be selected individually and optimized per-use, not as a dependency you install once.
What an actual lean icon workflow looks like
Pull only the icons you need, as raw SVG, not as a package dependency.
Instead of npm install some-icon-library and importing 40 components, grab standalone SVG markup for exactly the icons your UI uses. A library like Free SVG Icons works well for this — you search, copy the SVG code, and drop it straight into a component. No dependency, no version bumps, no unused glyphs sitting in your bundle.Edit the SVG before you ship it, not after.
Most raw SVG exports carry junk: unnecessarywrappers, hardcoded fill colors that fight your theme, inconsistent viewBoxes. Run it through a proper SVG code editor before it goes into your codebase — strip what you don't need, normalize the viewBox, and make fills currentColor so the icon inherits text color instead of being locked to one hex value. If you need visual restyling without touching markup, use a visual editor.
Sometimes you don't want to hand-edit paths. A visual SVG icon editor lets you recolor and restyle icons without opening the code view — useful when a designer, not a dev, needs to make the call on stroke weight or fill.Compress before commit, especially for icons with gradients or complex paths.
Not all SVGs are small by default. Icons with multicolor fills, gradients, or filter effects can carry real weight. Running assets through an image compressor before committing them catches this before it becomes a bundle-size surprise three sprints later.Standardize your icon style, not just your icon source.
Mixing outlined icons from one library with filled icons from another is the fastest way to make a UI look assembled rather than designed. Pick one visual language — line, outlined, or filled — and pull everything from that same style set so weight and corner radius stay consistent across the product.If you're in Figma before you're in code, keep the two in sync.
A lot of icon drift happens because design picks icons in Figma and engineering picks "close enough" replacements in code. Using the same source on both ends — like an icon plugin inside Figma — means the SVG a designer drags onto the canvas is the exact SVG that ends up in the component.
The part teams skip: auditing what's already shipped
If your app already has an icon problem, don't just fix new icons going forward — audit what's live. Pull up your bundle analyzer, find every icon-related import, and ask honestly: is this icon font/package earning its KB cost, or would six hand-picked SVGs do the same job for a fraction of the weight?
For teams doing a full rebuild of their icon set, browsing by category rather than searching one-by-one tends to surface a more visually consistent set, since icons in the same category are more likely to share stroke weight and corner logic.
Takeaway
Icons are one of the few areas of frontend where "just add a dependency" quietly costs you the most over time. Treat them like assets you curate, not a package you install — pick individually, normalize before commit, and keep design and code on the same source of truth.
Top comments (0)