Created
December 13, 2013 17:00
-
-
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…
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
$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