1

I am looking for a way to refer to a certain subclass of the parent of the block i am currently writing declarations in.

Let me illustrate.

Instead of:

.label {
    @extend .not-selectable;
    display: inline-block;
    line-height: 22px;
}

And then:

&.active .label {
    background-color: #eee;
}

I'd like to write something like:

.label {
    @extend .not-selectable;
    display: inline-block;
    line-height: 22px;
    << &.active {
        background-color: #eee;
    }
}

With the resulting, compiled CSS being exactly the same in both cases.

Is there any such syntax or hack or trick in SASS to achieve this?

SquareCat
  • 5,699
  • 9
  • 41
  • 75
  • Can you please refer [https://stackoverflow.com/questions/15668539/check-if-sass-parent-selector-exists-is-it-possible](https://stackoverflow.com/questions/15668539/check-if-sass-parent-selector-exists-is-it-possible). – Dhruvi Makvana Nov 22 '20 at 14:51

0 Answers0