R
R
Roman Yakimchuk2015-03-24 14:25:11
JavaScript
Roman Yakimchuk, 2015-03-24 14:25:11

Zen of BEM: where to keep .bemjson?

Good afternoon.
Learn the Zen of BEM. I really want to understand how BEMJSON should be decomposed correctly between bundles and blocks used by this bundle.
To make it as clear as possible what is at stake, I will give a specific example.
Example:
We have two bundles.
Each of the bundles contains a block on the page with the following structure (BEMJSON of this block):

{
    block: 'b-menu',
    content: [
        { elem: 'caption', content: 'Заголовок меню' },
        { elem: 'button', content: 'Кнопка в меню' }
    ]
}

Where should this BEMJSON be located, in the block folder, or in the .bemjson file of each of the bundles?
Is it even possible to assemble a BEMJSON bundle by specifying in it the names of only the blocks used (in the hierarchy), and not describing their content?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yaroshevich, 2015-07-07
@yakimchuk-ry

Bemjson describes the structure in blocks / elements and page data, bundles are, in essence, your pages.
It seems obvious now that bemjson needs to be placed in bundle folders.
What is it for? In order to know how the page is assembled and what it consists of. In fact, all artifacts are collected from this file, and the build process looks like this:
1. All names of blocks and elements described in the bemjson file are collected;
2. The *.deps.js files are collected from blocks and the general list of necessary files is supplemented with blocks from these files, and the same files of these blocks (recursively);
3. The complete list of files is written as bemdecl.js;
4. All technologies described in the assembly are assembled (js/css files/templates);
5. If the assembly was from bemjson, html is also generated from bemjson and templates (otherwise, just templates);
6. Minification and obfuscation of css/js files (or compilation of less/stylus/sass to css, es6/coffee to js, ​​etc.).
Something like this)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question