Created
March 14, 2014 00:13
-
-
Save rymizuki/9539803 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.3.2) | |
// Compass (v1.0.0.alpha.18) | |
// ---- | |
$state-when--types: ( | |
'active': ('&.is--active, &:active, &:hover'), | |
'current': ('&.is--current'), | |
'visible': ('&.is--visible') | |
) !global; | |
@mixin state-when ($states) { | |
@each $state in $states { | |
$selector: map-get($state-when--types, $state); | |
#{$selector} { | |
@content; | |
} | |
} | |
} | |
.example { | |
@include state-when('active') { | |
display: block; | |
}; | |
} | |
.example2 { | |
$states: 'active', 'current'; | |
@include state-when($states) { | |
background-color: red; | |
} | |
} |
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
.example.is--active, .example:active, .example:hover { | |
display: block; | |
} | |
.example2.is--active, .example2:active, .example2:hover { | |
background-color: red; | |
} | |
.example2.is--current { | |
background-color: red; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment