Skip to content

Instantly share code, notes, and snippets.

@danielguillan
Created December 13, 2013 17:00
Show Gist options
  • Save danielguillan/7947457 to your computer and use it in GitHub Desktop.
Save danielguillan/7947457 to your computer and use it in GitHub Desktop.
BEM object definition using mixins - Auto-generated selector names with configurable syntax style. - Enables nesting without actually generating over-specific selectors (>=Sass 3.3). - Generates ids, classes or silent (placeholder) classes. Can be configured per object. - More robust definition, less error-prone. possible future extensions. Over…
$element-separator: '__';
$modifier-separator: '--';
$class-type: '%';
@include block('flag') {
display: table;
width: 100%;
@include element('image') {
padding-right: 10px;
> img {
display: block;
max-width: none;
}
@include modifier('rev') {
padding-right: 0;
padding-left: 10px;
}
}
@include element('body') {
width: 100%;
}
@include elements('image', 'body') {
display: table-cell;
vertical-align: middle;
}
@include modifier('top') {
@include modifies-elements('image','body') {
vertical-align: top
}
}
@include modifier('bottom') {
@include modifies-elements('image','body') {
vertical-align: bottom;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment