From 7f169ebe65ee193bea303354653d6465bfc152d6 Mon Sep 17 00:00:00 2001 From: Jakub Benes Date: Wed, 15 May 2019 20:46:54 +0200 Subject: [PATCH] Dont remove fill in any case --- src/babel/pbfied.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/babel/pbfied.js b/src/babel/pbfied.js index 4d34c08..d637def 100644 --- a/src/babel/pbfied.js +++ b/src/babel/pbfied.js @@ -9,20 +9,9 @@ const SVG_REMOVE_ATTRS = ["width", "height"]; const CLASS_NAME = `pb-icon`; const pbfiedPlugin = ({ types: t }, options) => { - let countPath; - return { name: "pbfiedPlugin", visitor: { - Program: { - // Hacky why how to "scope" the global state, there is probably way better way, don't hesitate to send a PR to fix it - enter() { - countPath = 0; - }, - exit() { - countPath = 0; - } - }, VariableDeclarator(path) { const className = t.identifier("props"); @@ -47,16 +36,6 @@ const pbfiedPlugin = ({ types: t }, options) => { } }, JSXElement(path) { - if (path.node.openingElement.name.name === "svg") { - path.traverse({ - JSXOpeningElement(path) { - if (path.node.name.name === "path") { - countPath++; - } - } - }); - } - if (path.node.openingElement.name.name === "defs") { path.replaceInline(path.node.children.filter(t.isJSXElement)); } @@ -132,11 +111,6 @@ const pbfiedPlugin = ({ types: t }, options) => { if (path.node.name.name === "path") { const removeAttrs = [...PATH_REMOVE_ATTRS]; - // in case we have just one path, let's remove *fill* property since we want to inherit it from css - if (countPath === 1) { - removeAttrs.push("fill"); - } - path.node.attributes = [ ...path.node.attributes.filter( a => !removeAttrs.includes(a.name.name)