Answer the question
In order to leave comments, you need to log in
How to correctly name blocks according to BEM in a large project?
DD.
What will be the class .news-list
in styles for you? news list? but where?
Let's say the first programmer calls the main block with the list of news on the page of the News list.
Further/later, the second programmer raises the list of top news on the main page and also names the main block .news-list
. There is also a terrible modal menu sent by designers, where you also need to show a couple of news and again manage to name.news-list
parent block with news. Naturally, the appearance of these lists is different everywhere, an attempt to correct the style in one place leads to the fact that something breaks on the other side. I understand that it is possible to make edits according to the parent, but how is it correct according to BEM? it is clear that they want to make bricks and use them everywhere, but how to make bricks not break something else? how to distinguish and remember which bricks are already there?
Answer the question
In order to leave comments, you need to log in
for this, BEM has https://ru.bem.info/methodology/block-modification...
i.e. in your case it should be something like:
.news-list.in-main
.news-list.in-news-page
.news-list.in-modal
and style each accordingly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question