Files
4e8fec6845 perf(frontend): serve only the mdi icons the app uses (#5118)
* perf(frontend): serve only the mdi icons the app uses

@mdi/font ships a CSS rule and four font formats for every icon. Generate
a trimmed stylesheet from the icons named in the source and alias the
package import to it.

- scripts/build-icons.ts writes src/plugins/materialdesignicons-trimmed.css
  (woff2 only, LF line endings, no source map pointer). predev and prebuild
  run it through build:icons, and CI checks the committed file is current.
- scripts/trim-mdi-fonts.ts builds the allow list from src/, Vuetify's own
  icon set and the icons the backend names. Only a plain
  .mdi-name::before rule can be dropped; anything unsure is kept.
- Custom notification icons the app does not draw fall back to the level
  icon instead of rendering blank.
- An "All icons (mdi)" story under Primitives/RIcon shows every shipped
  icon with search, plus the icons that are available but not shipped.
- Vitest keeps ?raw CSS imports instead of emptying them.
- build:tokens leaves tokens.css alone when only formatting differs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* perf(frontend): trim the mdi icon css in a Vite plugin

Replace the generated, committed icon CSS with a transform plugin that
trims @mdi/font in memory, in dev, Storybook and build. A watcher
reloads dev when the source names a new icon. Drops build-icons.ts, the
alias, the CI staleness check and the checked-in CSS.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* PR feedback

* style(frontend): sort imports in notifications test

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* perf(frontend): reduce the mdi icon trim to a build-only plugin

Drop the icon browser story, the notification glyph probe, the
build:tokens compare and the woff2-only font rewrite. The plugin now
only removes unused icon rules in production builds, so dev serves the
full set and needs no file watcher.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Co-authored-by: Georges-Antoine Assi <[email protected]>
2026-10-08 07:25:40 -04:00
..
2026-07-04 14:22:27 -04:00