Login with github
Forum /

First of all, thanks for such an amazing methodology and tools. I'm very happy so far about the results.

Here is a little problem I'm facing.

{
    block: 'menu',
    type: 'red', // NOTICE i'm intentionally defining it as type not as mod
    items: [
        { title: 'BBC', url: 'http://bbc.co.uk'},
        { title: 'CNN', url: 'http://cnn.com'}
    ]
}

My BEMJSON layouts being more abstract makes me more productive. I would like to ignore details like mods, elems and define them "on the fly" with BEMHTML block (re?)definitions.

block('menu')(
    mods()(function() {
        let custom_mods = {}

        custom_mods[this.ctx.type ? this.ctx.type : 'black'] = true; // menu_red, menu_black, etc.

        return Object.assign({}, this.ctx.mods, custom_mods)
    })
)

The possibilities are endless here. Amazing. Just what I wanted...

Except! My dependencies for menu_red are not included now.

Adding red mod to menu.deps.js is not a solution, because this way red is part of the bundle although BEMJSON defines only GREEN.

Is there a workaround? Thanks,