S
S
sysaknikolay2015-09-15 08:45:44
css
sysaknikolay, 2015-09-15 08:45:44

Isn't style.css overloading the class namespace in BEM fashion?

When the context is not used due to direct access to the desired block or element.
For example

<ul class="nav-menu nav-theme__name">
    <li class="nav-menu__item"><a class="nav-menu__link" href="#">item</a></li>
    <li class="nav-menu__item"><a class="nav-menu__link" href="#">item</a></li>
</ul>

I find BEM to be quite handy. But is it worth using it to the point of directly specifying style rules for elements of an independent block? and it’s not worth adding context to BEM (after all, it turns out that BEM is no longer there)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
i, 2015-09-15
@sysaknikolay

BEM is not a dogma and only about css , like any other design pattern it helps to manage complexity, the limitation that can be seen is the subjective perception of the observer.
If I understand the question correctly, nothing prevents using global normalization (namely, normalization, not reset) for elements, and this makes the final blocks more independent of their environment. When the use of style rules for elements makes a block dependent on an element or context, it violates only one of the principles of the methodology on the implementation aspect of the block and vice versa. And only independently it is possible to make decisions whether it is worth doing it and how it can affect the overall process.
Complement by example if nav-theme__nameis a modifier with a value of name , then following the classic naming, nav-menu_theme_name (block_mod_value) would be correct.
The naming convention is specific and in this aspect it is important not to deviate from the agreements.
Additionally, I recommend looking at https://ru.bem.info/forum/?labels=css
And yet, using global styles (normalize/reset) contradicts the trailer: "A block is an independent component", more: experience and recommendation .

R
Ramil, 2015-09-15
@vafarulez

If you use bem tools, then you will have the opportunity to collect your own css for each page. With bam, you are editing blocks on the page, not the page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question