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 ruleP2stack specificStack: css
scssdrynestingmaintainability
Nest related CSS selectors and extract shared rules into a base class
When classes share most of their declarations, nest variants and extend a common base instead of repeating the rules.
PR: vinify-frontend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codescss
| 1 | .highlight { background: yellow; padding: 0; } |
| 2 | .highlightActive { background: orange; padding: 0; outline: 2px solid; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .highlight { |
| 2 | background: yellow; |
| 3 | padding: 0; |
| 4 | &Active { background: orange; outline: rem-calc(2) solid; } |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)