bh icon indicating copy to clipboard operation
bh copied to clipboard

Support plain block mixes

Open mishanga opened this issue 9 years ago • 5 comments

{ block: 'a', mix: 'b' } => <div class="a b"></div> Also: ctx.mix('a__b') => ctx.mix() => '{ block: 'a', elem: 'b' } { mix: 'a__b_c' }

mishanga avatar Mar 16 '15 09:03 mishanga

https://github.com/bem/bem-naming

mishanga avatar Mar 16 '15 09:03 mishanga

I think we won't be able to support also part in BEMHTML.

tadatuta avatar Mar 16 '15 17:03 tadatuta

since naming separators is part of options in render function we just can't enforce any particular separator in { mix: 'a__b_c' }

inside of BH (ctx.mix('a__b')) it's acceptable because of using particular separator in matches

veged avatar Aug 19 '15 01:08 veged

What if we will expose parsing/stringifying function and let users to redefine it? Like bh.setOption('naming', { parse: function (str): Object, stringify: function (obj): string }); to fill all internal needs. And then it will be possible to use custom syntax in both places: matchers and mixes.

upd: btw, https://github.com/bem/bh/blob/master/lib/bh.js#L763-L784 — this is the current parser. https://github.com/bem/bem-naming/blob/master/lib/bem-naming.js#L129 — parser in bem-naming

Looks like this: bh.setOptions('naming', require('bem-naming')({ 'any-custom': 'naming-params' })); will work in that way ;-)

qfox avatar Aug 19 '15 19:08 qfox

such approach doesn't support mixing different styles of separators in one runtime — anyway, I think customisation of BH match syntax is different issue

veged avatar Aug 20 '15 14:08 veged