Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2universalStack: javascript
bundle-sizeperformancesvgassets
Don't inline large SVGs that balloon the bundle when a cacheable asset works
Inlining an SVG into the JS bundle can multiply its size; for non-critical icons prefer a referenced/cacheable asset (e.g. a span with a background or external file) loaded separately.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codejsx
| 1 | import HugeIconSvg from 'generated/HugeIconSvg'; |
| 2 | <HugeIconSvg /> // inlined, +5x bundle |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejsx
| 1 | <span className={styles.icon} /> // background image, cached, separate request |
Explanation (EN)
Objašnjenje (HR)