Created
July 31, 2014 08:38
-
-
Save anatomic/c87da804c31f5418c980 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
// ---- | |
// libsass (v2.0.0) | |
// ---- | |
@import "sass-list-maps"; | |
$selector: push; | |
$modifiers: (left right top bottom); | |
$space: 2em; | |
/* In BEM methodology we would want our modifiers to be prefixed with `--` | |
however, libsass fails to compile anything within an `@each` block that uses | |
a double hyphen */ | |
/* Expected output */ | |
.push--left { | |
margin-left: $space; | |
} | |
/* What we can actually get out of libsass*/ | |
@each $modifier in $modifiers { | |
.#{$selector} { | |
&-#{$modifier} { | |
margin-#{$modifier}: $space; | |
} | |
} | |
// This causes an error | |
// .#{$selector} { | |
// &--#{$modifier} { | |
// margin-#{$modifier}: $space; | |
// } | |
// } | |
// As does this | |
// .#{$selector}--#{$modifier} { | |
// margin-#{$modifier}: $space; | |
// } | |
} |
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
/* In BEM methodology we would want our modifiers to be prefixed with `--` | |
however, libsass fails to compile anything within an `@each` block that uses | |
a double hyphen */ | |
/* Expected output */ | |
.push--left { | |
margin-left: 2em; } | |
/* What we can actually get out of libsass*/ | |
.push-left { | |
margin-left: 2em; } | |
.push-right { | |
margin-right: 2em; } | |
.push-top { | |
margin-top: 2em; } | |
.push-bottom { | |
margin-bottom: 2em; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment