Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
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.
Bad example
| 1 | .titleAndImage .mainText { color: #151719; font-size: 14px; margin-top: 5px; } |
| 2 | .infoAndTitle .mainText { color: #151719; font-size: 14px; margin-top: 5px; } |
Explanation (EN)
Duplicated common presentation is easy to update inconsistently.
Objašnjenje (HR)
Good example
| 1 | .mainText { color: #151719; font-size: 14px; margin-top: 5px; } |
Explanation (EN)
All three originally shared declarations remain shared, including the margin that both hosts had.
Objašnjenje (HR)
Notes (EN)
Extract common declarations only for the intended shared target class, preserving all properties that were common and keeping host-specific differences explicit.
Exceptions / Tradeoffs (EN)
Moving a class to a broader scope can affect additional consumers; inspect every use and preserve required specificity.