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: CSS
cssscssdrymaintainability
Lift duplicated styles into one shared class and override per variant
When two selectors repeat the same declarations, define a common class at a higher level and only add variant-specific overrides.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .titleAndImage .mainText { color: #151719; font-size: 14px; margin-top: 5px; } |
| 2 | .infoAndTitle .mainText { color: #151719; font-size: 14px; margin-top: 5px; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .mainText { color: #151719; font-size: 14px; } |
| 2 | .titleAndImage .mainText { margin-top: 5px; } |
| 3 | .infoAndTitle .mainText { /* only differences */ } |
Explanation (EN)
Objašnjenje (HR)