Last active
August 29, 2015 14:08
-
-
Save msikma/b929c151093b9d899aa6 to your computer and use it in GitHub Desktop.
Set container pseudo-selector states
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
@mixin set-states($states) { | |
$selector: (); | |
@for $i from 1 through length($states) { | |
$selector: append($selector, unquote("&:#{nth($states, $i)}"), comma); | |
} | |
#{$selector} { | |
@content; | |
} | |
} | |
div { | |
@include set-states('a' 'b' 'c') { | |
color: purple; | |
} | |
} | |
/* output: | |
div:a, div:b, div:c { | |
color: purple; | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment