Answer the question
In order to leave comments, you need to log in
Reflections on BEM. Duplicate files or treat element as a block?
I'm still learning about BEM.
Consider a simple search form. From the BEM point of view, this form is a block consisting of two, for example, elements: an input field and a button. The specs also say that a block is a "brick" and an element is a part of a block that has no meaning outside of that block. Thus, the file structure of the search form looks like this:
blocks/
search/
search.xsl
search.css
__input/
search__input.xsl
search__input.css
__button/
search__button.xsl
search__button.css
blocks/
login/
login.xsl
login.css
__input/
login__input.xsl
login__input.css
__button/
login__button.xsl
login__button.css
blocks/
input/
input.xsl
input.css
_type/ <!-- При необходимости вешаем модификаторы -->
input_type_login.xsl
input_type_login.css
input_type_search.xsl
input_type_search.css
button/
button.xsl
button.css
_type/ <!-- При необходимости вешаем модификаторы -->
button_type_login.xsl
button_type_login.css
button_type_search.xsl
button_type_search.css
Answer the question
In order to leave comments, you need to log in
Found the answer. Such a division into elements exists and is called bam-components.
en.bem.info/libs/bem-components/v2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question