Skip to content

Instantly share code, notes, and snippets.

@msikma
Last active August 29, 2015 14:08
Show Gist options
  • Save msikma/b929c151093b9d899aa6 to your computer and use it in GitHub Desktop.
Save msikma/b929c151093b9d899aa6 to your computer and use it in GitHub Desktop.
Set container pseudo-selector states
@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