Last active
December 31, 2015 08:49
-
-
Save lukasborawski/7962838 to your computer and use it in GitHub Desktop.
SCSS multiclass BEM model @mixin.
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
<div class="bg_white-black"></div> |
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
@mixin el($name) { | |
@at-root #{&}[class*="_#{$name}"] { | |
@content; | |
} | |
} | |
@mixin md($name) { | |
@at-root #{&}[class*="-#{$name}"] { | |
@content; | |
} | |
} | |
$model: bg; | |
[class*="#{$model}"] { | |
border: gray 1px solid; | |
@mixin colors() { | |
@include md(black){ | |
color: black; | |
} | |
} | |
@at-root { | |
@include el(white) { | |
background-color: white; | |
@include colors; | |
} | |
@include el(lightgray) { | |
background-color: lightgray; | |
} | |
} | |
} |
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
[class*="bg"] { | |
border: gray 1px solid; | |
} | |
[class*="bg"][class*="_white"] { | |
background-color: white; | |
} | |
[class*="bg"][class*="_white"][class*="-black"] { | |
color: black; | |
} | |
[class*="bg"][class*="_lightgray"] { | |
background-color: lightgray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment