F
F
freddylink2017-07-24 23:04:27
gulp.js
freddylink, 2017-07-24 23:04:27

BEM, how to make the correct connection of dependent blocks?

The index.bemjson.js bundle code looks like this:

module.exports = {
    block: 'page',
    title: 'Title of the page',
    favicon: '/favicon.ico',
    head: [
        { elem: 'meta', attrs: { name: 'description', content: '' } },
        { elem: 'meta', attrs: { name: 'viewport', content: 'width=device-width, initial-scale=1' } },
        { elem: 'css', url: 'index.min.css' }
    ],
    scripts: [{ elem: 'js', url: 'index.min.js' }],
    mods: { theme: 'islands' },
    content: [
        {
            block: 'header',

        }
    ]
};

In the header block, in the header.deps.js file, I set the dependency like this:
({
    
    shouldDeps: [
        {
            block: 'logo',
            mods: {theme: 'sea'}
        }
    ]
})

Accordingly, the logo block exists, and it has styles.
But when building the project, the header block does not contain any nesting.
Accordingly, the question is: how to add nesting?
Or is it not supposed to work like this, and in any case, index.bemjson.js should have a block within a block explicitly written in it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freddylink, 2017-07-25
@freddylink

Helped on the bema forum itself:
If you want to make the logo automatically appear in the markup inside the header block, then you need to add the header.bemhtml.js template:

block('header').content()({ block: 'logo', mods: { theme: 'sea' } });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question