babel-plugin-encours
Advanced tools
+1
-1
| { | ||
| "name": "babel-plugin-encours", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "description": "A small plugin to transpile jsx for the encours framework", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
+0
-8
@@ -9,11 +9,7 @@ module.exports = function (babel) { | ||
| var stringChild = t.stringLiteral(path.node.value); | ||
| //console.log(path.scope); | ||
| path.replaceWith(stringChild, path.node); | ||
| }, | ||
| JSXElement(path) { | ||
| //get the opening element from jsxElement node | ||
| var openingElement = path.node.openingElement; | ||
| //tagname is name of tag like div, p etc | ||
| var tagName = openingElement.name.name; | ||
| // arguments for React.createElement function | ||
| var args = []; | ||
@@ -55,3 +51,2 @@ //adds "div" or any tag as a string as one of the argument | ||
| const child = children[i]; | ||
| console.log("node", children[i]); | ||
| if (child.type === "JSXElement") { | ||
@@ -68,5 +63,2 @@ childArray.push(child); | ||
| callExpression.arguments = callExpression.arguments.concat(childArray); | ||
| //callExpression.arguments = callExpression.arguments.concat(path.node.children); | ||
| // replace jsxElement node with the call expression node made above | ||
| path.replaceWith(callExpression, path.node); | ||
@@ -73,0 +65,0 @@ }, |
4837
-7.85%86
-7.53%