Skip to content

Instantly share code, notes, and snippets.

@anatomic
Created July 31, 2014 08:38
Show Gist options
  • Save anatomic/c87da804c31f5418c980 to your computer and use it in GitHub Desktop.
Save anatomic/c87da804c31f5418c980 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// 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;
// }
}
/* 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