Skip to content

smdenis/bemjson-to-jsx

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bemjson-to-jsx

Transforms BEMJSON objects to JSX markup.

NPM Status Travis Status Coverage Status Dependency Status

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'}/>"