bem-sdk-archive / bemjson-to-jsx

https://bem-sdk-archive.github.io/bemjson-to-jsx. DEPRECATED →
https://github.com/bem/bem-sdk/tree/master/packages/bemjson-to-jsx
Other
2 stars 2 forks source link

We need to pascaleCase tags #43

Closed Yeti-or closed 6 years ago

Yeti-or commented 6 years ago

as it done here: https://github.com/Yeti-or/bemjson-to-jsx-loader/blob/master/index.js#L115

Yeti-or commented 6 years ago

I think this is okay:

const classesInseteadOfTags = function(jsx, json) {
    if (jsx.bemEntity) {
        jsx.tag = pascalCase(jsx.tag);
    }
};

or more like:

const classesInseteadOfTags = function(jsx, json) {
    if (jsx.bemEntity) {
        jsx.tag = jsx.bemEntity.elem ? jsx.bemEntity.id : pascalCase(jsx.bemEntity.id);
    }
};
qfox commented 6 years ago

Please pass this as a function in options. Please DON'T use bemEntity.id as naming stringify function.

Yeti-or commented 6 years ago

@zxqfox I will use pascalCase(bemEntity.toString()) is it okay for you? cause I need to get BlockElem string Or do you prefer ${pascalCase(bemEntity.block)}${pascalCase(bemEntity.elem)} ?

qfox commented 6 years ago

The second one.