`import '@clr/icons/shapes/all-shapes'` in app.component.ts pulled every shape in the package into the initial bundle - 718 kB of SVG on the critical path before anyone has logged in. The package has no per-shape entry point: the modules are UMD bundles that register whole families (core, essential, technology, social, commerce, travel, media, chart, text-edit), so the only way to shed the unused ones is to register a curated set. `client/scripts/generate-clr-shapes.js` reads `shape="..."` out of the templates and lifts those shapes - and the aliases Clarity defines over them, such as `caret` for `angle` and `close` for `times` - out of the installed package, plus the shapes Clarity's own components draw. It writes `src/app/clr-shapes.ts`, which app.component registers with `ClrIcons.add`. Measured on a production build of this branch against release/7.23: main.js 2,951,405 -> 2,367,232 bytes (-584 kB, -19.8%) all JS 9,746,084 -> 9,161,911 bytes (-584 kB) Verified rather than assumed: the production build served statically and loaded in headless Chrome carries 8 `clr-icon` elements on the landing screen - caret, check, check-circle, circle, error, tree-view - and every one renders an `<svg>` child, so the curated registry resolves the aliases and the direction modifier (`shape="caret down"`) correctly. Karma: 896 SUCCESS. The generated file cannot go stale silently: `prebuild`, `prebuild-dev` and `prebuild-watch` regenerate it, and the script exits non-zero if a template names a shape the installed package does not carry.
8 lines
356 B
Plaintext
8 lines
356 B
Plaintext
# Auto-generated at build time (node ./src/version.ts) — gitignored, never linted.
|
|
# Formerly skipped via root .gitignore when prettier ran from the repo root;
|
|
# now that lint runs from client/, prettier reads this CWD-local ignore instead.
|
|
src/environments/version.ts
|
|
|
|
# Generated by scripts/generate-clr-shapes.js on every build.
|
|
src/app/clr-shapes.ts
|