Created
May 28, 2020 16:33
-
-
Save xdesro/597c34fd997629a598a3430463ffd8c7 to your computer and use it in GitHub Desktop.
Caching specificity context using Sass' &.
This file contains 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
.nav-item { | |
&__link { | |
color: red; | |
} | |
$this: &; | |
&:first-of-type { | |
&__link { | |
// this won't work 😞 | |
color: blue; | |
} | |
#{$this}__link { | |
// this will, though! 💫 | |
color: blue; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment