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 ruleP1stack specificStack: css
scssselectorsnestingcorrectness
Use the Sass ampersand correctly for compound and nested selectors
Nest related classes properly and use & only when classes truly co-occur on the same element; a bare nested class targets a descendant, not the same node.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codescss
| 1 | .root { |
| 2 | .container { color: red; } // targets a descendant .container, not .root.container |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .votingContainer { |
| 2 | &.active { color: red; } // matches element with both classes |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)