rctneil
rctneil

Reputation: 7210

Sass Multiple Selector Refactoring

I remember reading about a Sass feature that allowed you to specify a list of elements and then a child and it would compile to a list of multiple selectors. I ahve searched around but can't find it.

I want it to compile down to this:

header .container,
footer .container
  background: yellow

But i'm sure there is a feature of Sass that allows writing that in a much nicer way.

Any ideas?

Upvotes: 3

Views: 2281

Answers (1)

cimmanon
cimmanon

Reputation: 68319

That style could be refactored as this:

.container {
    header &, footer & {
        background: yellow;
    }
}

But maybe you are thinking of a Compass feature? http://compass-style.org/reference/compass/helpers/selectors/#nest

Upvotes: 3

Related Questions