Jade Mixins for the Rapid BEM Coding
include jade-de-bem
+div(class="block --special")
+ul(class="__items foo")
+li(class="__item --new foo bar")
+a(class="__link baz")
| Foo
- Include the
jade-de-bem
mixin. - Follow the class rules. See the specification.
- That's it.
<div class="block block--special">
<ul class="block__items foo">
<li class="block__item block__item--new foo bar">
<a class="block__link baz">Foo
</a>
</li>
</ul>
</div>
$ bower install jade-de-bem
- or download master.zip
Start with +
sign and keep the className order.
+E(class="(block|__element|--modifier__element) [--modifier] [else]")
https://github.com/internets-inc/jade-de-bem/blob/master/lib/bem.jade#L5-L6
config.element = '__'
config.modifier = '--'
Unfortunately, you need to terminate child scopes when you have them.
+bem(false)
Use like this:
+div(class="parent")
+header(class="__header")
+div(class="__main")
+div(class="child")
+ul(class="__items")
+li(class="__item")
+bem(false)
+footer(class="__footer")
Yields:
<div class="parent">
<header class="parent__header">
</header>
<div class="parent__main">
<div class="child">
<ul class="child__items">
<li class="child__item">
</li>
</ul>
</div>
</div>
<footer class="parent__footer">
</footer>
</div>
MIT