I have the following HTML code, I tend to have a 3 code project identifier at the start
<span class="abc-user-overview__header__title">
<span class="abc-user-overview__header__title__name">
{{ name }}
<span class="abc-user-overview__header__active">true</span>
</span>
Although the 'name' element is a child of title, how strict does the naming convention have to be? As I think abc-user-overview__header__title__name is too long and would prefer to drop the __title, giving me:
<span class="abc-user-overview__header__title">
<span class="abc-user-overview__header__name">
{{ name }}
<span class="abc-user-overview__header__active"true</span>
</span>
Is this valid and acceptable BEM?
Sadly your code is not valid according to BEM convention. This is the official name structure block-name__elem-name_mod-name_mod-val
.
Here is your code with valid BEM naming:
<span class="abc-user-overview__title">
<span class="abc-user-overview__name">{{ name }}</span>
<span class="abc-user-overview__status abc-user-overview__status_active">true</span>
</span>
Few tips:
.news-list
, but on other we may display Products, so reusing block with name .news-list
with Products inside isnt very nice. In this case a simple class like .list
will be enough.block
, not an element
.Full documentation and great examples can be found in the official website: https://en.bem.info/methodology/naming-convention/#naming-rules