Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Extract repeated SCSS declarations into a parameterized mixin
Replace blocks of the same property set repeated across rules (e.g. flex centering) with a reusable mixin that accepts parameters with sensible defaults.
Bad example
| 1 | .a { display: flex; justify-content: center; align-items: center; } |
| 2 | .b { display: flex; justify-content: center; align-items: center; } |
Explanation (EN)
Repeated copies of the same styling concept can diverge when one occurrence changes.
Objašnjenje (HR)
Good example
| 1 | @mixin flex-center { |
| 2 | display: flex; |
| 3 | justify-content: center; |
| 4 | align-items: center; |
| 5 | } |
| 6 | .a { @include flex-center; } |
| 7 | .b { @include flex-center; } |
Explanation (EN)
Both selectors retain exactly the original property set; the extracted mixin adds no direction reset.
Objašnjenje (HR)
Notes (EN)
Extract repeated SCSS when the blocks share one stable styling concept and a small existing mixin or utility can represent it without extra declarations.
Exceptions / Tradeoffs (EN)
Two short independent blocks may be clearer inline. Default parameters must not introduce a direction/alignment reset absent from the original cascade.