zerkms
zerkms

Reputation: 255115

Duplication in css selectors, SCSS

Let's say I have such style definitions:

.a.b   { ... }
.a.b.c { ... }

Is there a way to avoid .a.b part duplication using SASS/SCSS?

Upvotes: 0

Views: 102

Answers (1)

BoltClock
BoltClock

Reputation: 724452

Nest the .a.b.c rule within .a.b and replace the first part with the & combinator:

.a.b {
    ...
    &.c { ... }
}

Upvotes: 5

Related Questions