Skip to content

Instantly share code, notes, and snippets.

@d13
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d13/90aa65b955907209c430 to your computer and use it in GitHub Desktop.
Save d13/90aa65b955907209c430 to your computer and use it in GitHub Desktop.
LESS and BEM experiment
#BEM {
.glue(@glue, @selector, @styles) {
&@{glue}@{selector} {
@styles();
}
}
.e(@name, @styles) {
#BEM > .glue(__, @name, @styles);
}
.m(@name, @styles) {
#BEM > .glue(--, @name, @styles);
}
}
.my-block {
#BEM > .m(~'red', {
color: red;
});
#BEM > .e(~'link', {
color: green;
#BEM > .m(~'blue', {
color: blue;
});
});
}
.my-block--red {
color: red;
}
.my-block__link {
color: green;
}
.my-block__link--blue {
color: blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment