fix(icons): stop collapsing multi-path icons in the generator#519
Merged
kelsos merged 1 commit intorotki:mainfrom Apr 27, 2026
Merged
fix(icons): stop collapsing multi-path icons in the generator#519kelsos merged 1 commit intorotki:mainfrom
kelsos merged 1 commit intorotki:mainfrom
Conversation
The generator was running ~190 lines of hand-rolled SVG path parsing to flatten lucide's per-primitive `[tag, attrs]` entries into a single concatenated `d` string. That round-trip rendered badly on multi-segment icons (most visibly `lu-eye-off`). Rewrite as TypeScript that passes lucide data through verbatim and emits one tuple per renderable primitive for custom SVGs; use `fast-glob`, parallel imports and writes, and fail-fast on broken icons. `RuiIcon.vue` is unchanged. Generated chunk headers also suppress the usual lint/format noise (eslint, prettier, dprint, oxlint, biome). Docs corrected (`generate:icons` -> `generate-icons`, `remix-icons` -> Lucide, src/icons/ flagged as gitignored). `tsconfig.node.json` includes `src/types/icons.ts` so the script can import `GeneratedIcon` under node16 module resolution.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #519 +/- ##
=======================================
Coverage 84.87% 84.87%
=======================================
Files 143 143
Lines 5209 5209
Branches 1553 1553
=======================================
Hits 4421 4421
Misses 788 788 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The build-time icon generator was running ~190 lines of hand-rolled SVG path parsing to flatten lucide's per-primitive
[tag, attrs]entries into a single concatenateddstring. That round-trip rendered badly at small sizes on multi-segment icons — most visiblylu-eye-off, which collapsed to little more than its diagonal slash inside menu rows.This rewrites the generator (now TypeScript) to:
defaultexport through verbatim — its shape is already whatRuiIconconsumes;path,rect,circle,ellipse,line,polyline,polygon);fast-glob(already a project dep, used inbuild-web-types.mjs) instead of two near-duplicate recursive walkers + per-leaflstat;consola.warn+ missing export);RuiIcon.vueis intentionally unchanged — it already iteratescomponentsand renders each tuple, so multi-entry output drops in cleanly.Side effects
tsconfig.node.jsonincludessrc/types/icons.tsso the script can importGeneratedIconunder node16 module resolution.generate:icons→generate-icons,remix-icons→Lucide, clarified thatsrc/icons/is gitignored.Test plan
pnpm typecheckclean.pnpm lint— zero errors on the new script.pnpm test:run— 69 files / 1069 tests passing.pnpm build— emits 4 chunks; multi-path icons now have multiple["path", ...]entries.pnpm generate-iconsruns in ~1.7 s end-to-end (parallelized)./iconsand storybook renderlu-eye-off,lu-trash-2,lu-bug,lu-rotate-ccwwith all subpaths at both 24 px and 18 px.