Last active
August 29, 2015 14:11
-
-
Save daneden/76d7e95ff40e35c8e913 to your computer and use it in GitHub Desktop.
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
.block { | |
&:hover { | |
&__element { | |
color: red; | |
} | |
} | |
} | |
/* Expected/desired output: */ | |
.block:hover .block__element { | |
color: red; | |
} | |
/* Actual output: */ | |
.block:hover__element { | |
color: red; | |
} | |
/* This is not a thing :( */ | |
/* Shitty workaround: */ | |
.block { | |
$n: #{&}; | |
&:hover { | |
#{$n}__element { | |
color: red; | |
} | |
} | |
} | |
/* This works: */ | |
.block { | |
&:hover &__element { | |
color: red; | |
} | |
} | |
/* But, sadly, still means relatively more labor if I want to style more than one thing in the pseudo-class/state: */ | |
.block { | |
&:hover &__element { | |
color: red; | |
} | |
&:hover &__bar { | |
color: blue; | |
} | |
&:hover &__foo { | |
color: green; | |
} | |
} | |
/* VS: */ | |
.block { | |
&:hover { | |
&__element { | |
color: red; | |
} | |
&_bar { | |
color: blue; | |
} | |
&__foo { | |
color: green; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SassMeister test: http://sassmeister.com/gist/d88368304e4b5d674c82