Answer the question
In order to leave comments, you need to log in
How to create in bem: block block?
I write in the console: bem create -l desktop.blocks/ -b block1 -T css
Next, I want to create 1 more block in this block:
bem create -l desktop.blocks/block1 -b block2 -T css
block: 'block1',
content: {
block: 'block2',
content: [
{ ...
Answer the question
In order to leave comments, you need to log in
To create block files in desktop.blocks/block1 with the command:
You need to create a level description file desktop.blocks/block1/.bem/level.js with the content:
As a result, for bem-tools, the block1 folder will not just be a block folder, but also an override level like desktop.blocks . If this may seem convenient, see the topic Grouping Blocks Inside an Override Level .
For completeness of the answer, it is important to note that in order to use the above bemjson , it is enough to create a block block2 block with the command:
Blocks are independent components that do not need to know where they can be nested (of course, there may be exceptions). They are created at the redefinition level without a hierarchy, and nesting is described in bemjson .
The whole idea of BEM, in my personal understanding, lies precisely in the concept of independent blocks, and therefore what you wanted to do seems to be wrong. It would be better to do so
After that, it will be possible to add the necessary technologies with the -T key, and as I remember, it is used for those cases where the block already exists and it is required to redefine or redefine the block at some level of technology. After that, you can use it repeatedly in any block at any nesting level, regardless of the rest.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question