bemjson-to-jsx
v1.10.3
Published
Transform BEMJSON to JSX
Downloads
16
Readme
bemjson-to-jsx
Transforms BEMJSON objects to JSX markup.
Install
$ npm install --save bemjson-to-jsx
Usage
const bemjsonToJSX = require('bemjson-to-jsx')();
var bemjson = {
block: 'button2',
mods: { theme: 'normal', size: 'm' },
text: 'hello world'
};
var jsxTree = bemjsonToJSX.process(bemjson);
console.log(jsxTree.JSX);
// → "<Button2 theme={'normal'} size={'m'} text={'hello world'}/>"
Options
isNameSpacedElems
isNameSpacedElems
Change generation of JSX Class
true
— Block.Elemfalse
— BlockElem ( default )
const bemjsonToJSX = require('bemjson-to-jsx')({ isNameSpacedElems: true });
var bemjson = {
block: 'button2',
elem: 'text'
text: 'hello world'
};
var jsxTree = bemjsonToJSX.process(bemjson);
console.log(jsxTree.JSX);
// → "<Button2.Text text={'hello world'}/>"