Last active
June 11, 2019 10:34
-
-
Save scheibome/d9787b0834b3ed5ca5972ce09668d8fe to your computer and use it in GitHub Desktop.
How can I write this in #SCSS without writing the >li again? I don't have a clue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How can I write this in #SCSS without writing the > li for message--error again? | |
// like .message.message--error > li | |
.message { | |
> li { | |
background-color: green; | |
} | |
&.message--error { | |
> li { | |
background-color: red; | |
} | |
} | |
} |
gisu
commented
Jun 11, 2019
.message { > li { background-color: green; .message--error & { background-color: red; } } }
Unfortunately, this is not what I want.
Find a solution:
//.message > li {
// background-color: green;
//}
//.message--error.message > li {
// background-color: red;
//}
.message {
> li {
@at-root & {
background-color: green;
}
@at-root .message--error#{&} {
background-color: red;
}
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment