diff --git a/lib/plugins.js b/lib/plugins.js index 57aeb9fb..9627a22c 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -10,14 +10,14 @@ module.exports.defaultPlugins = [ if(~blackList.indexOf(k)) { return; } if(k === 'attrs') { bemjson[k]['style'] && (jsx.props['style'] = bemjson[k]['style']); - delete bemjson[k]['style']; } jsx.props[k] = bemjson[k]; }); }, function styleToObj(jsx) { - jsx.props['style'] && (jsx.props['style'] = styleObj(jsx.props['style'])); + jsx.props['style'] && + (jsx.props['attrs']['style'] = jsx.props['style'] = styleObj(jsx.props['style'])); } ]; @@ -37,11 +37,14 @@ module.exports.whiteList = function(options) { }; function styleObj(style) { - return style.split(';').reduce((acc, st) => { - if (st.length) { - var prop = st.split(':'); - acc[prop[0]] = prop[1]; - } - return acc; - }, {}); + if (typeof style === 'string') { + return style.split(';').reduce((acc, st) => { + if (st.length) { + var prop = st.split(':'); + acc[prop[0]] = prop[1]; + } + return acc; + }, {}); + } + return style; }