4. http://jyaasa.comCopyright 2016. Jyaasa Technologies.
● Solved an issue that has been bothering us since adopting BEM
● Removed ambiguity from our code
● Build a super flexible UI Library
● Enabled those less skilled in Frontend practices to be productive
5. http://jyaasa.comCopyright 2016. Jyaasa Technologies.
Bem Modifier in two different way
● Single Class
● Multiple Class
/* Single Class */
<button class =”btn-primary”></button>
/* Multiple Class */
<button class =”btn btn--green btn--large ”></button>
6. http://jyaasa.comCopyright 2016. Jyaasa Technologies.
● Easy to understand at a glance
● Pushes all the logic into the CSS
● Makes use of Sass’ @extend to make the modifications
● Best suited for modules that only need to make one modification at a time
Benefits of a single class modifie
Single Class
7. http://jyaasa.comCopyright 2016. Jyaasa Technologies.
● Logic kept in the HTML
● Configure any given module on the fly
● Best suited for modules with multiple modifiers
● that are designed to be mixed and matched. Benefits of multiple classes
Multiple Class
13. Variation
Single Class approach
<button class =”btn-primary”></button>
Variation Rules
● Can only apply one 'variation' at a time
● No need to repeat base class
● Can use Sass @extends to build
● Or can write a custom variation (no @extends)
● Can combine with Modifiers Variation rules
18. Golden Rule:
● See ‘Golden rule'
● Use a namespace which describe the change
e.g. size, color, width etc
● Use generic descriptors
e.g. large, primary, dark etc
19. Combining Variations and Modifiers
<button class="btn--3d -color-primary -size-large -width-full">
21. Benefits of BEVM
● Build a super flexible UI Library
● Configure modules in the HTML
● Short, concise syntax
● Reducing the amount of CSS that we need to write
● Increases development speed
● Can still use ‘variations' if you want
● Works with ‘helper' and 'state' classes