On Github bwasilewski / SassBEM
Ben Wasilewski
<button class="btn btn-primary btn-sm btn-do-something">Do Something</button>
created by Yandex in 2012
Naming Convention
Development Methodology
Modularize CSS
Communicate to other developers the purpose of a module
/* Search Block */ .search { } /* Search Element */ .search__field { } /* Search Block Modifier */ .search--primary { }
/* Search Block */ .search { }
/* Search Elements */ .search__field { } .search__button { }
/* Search Block Modifier */ .search--secondary { }
/* Navigation Item Modifier */ .nav__item--active { }
Sass selectors that only compile if extended.
Inherit styles from a "silent" selector. Override as necessary.
%nav { display: block; position: absolute; } .nav--primary, .nav--secondary { @extend %nav; } // override the inherited style .nav--secondary { display: inline-block; }
Download or view this presentation http://bwasilewski.github.io/SassBEM/
http://github.com/bwasilewski/SassBEM/ Read more about Sass, BEM, and Placeholder Selectors MindBEMding: Getting Your Head Around BEM Syntax
OOCSS Plus Sass is The Best Way to CSS
Extending Silent Classes in Sass