Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Dont remove fill in any case
Browse files Browse the repository at this point in the history
  • Loading branch information
jukben committed May 15, 2019
1 parent 169aa2b commit 7f169eb
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/babel/pbfied.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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));
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7f169eb

Please sign in to comment.