I would like to implement something like a BEM model in my Sass library. But I'm struggling to find a clean way to do this.
For example, I would like to declare a “base” style for a generic element, and then expand it with useful options:
.container { margin: 10%; background:
The problem is that the generated .container-featured class contains only the border property - Sass does not include the marker and background from its parent class.
So, you need to double the classes in your markup to get the desired results:
<div class="container container-featured"> ... </div>
Is there a way to pull properties from the parent class into the modifier class so that you can get the same visual result by simply referring to the modifier class in your markup?
<div class="container-featured"> </div>
I tried using mixins to do this, but things get verbose and repeating very quickly:
@mixins container { margin: 10%; background:
Is there a simple, clean way to achieve this with Sass?
source share