Skip to content

Commit 50a4973

Browse files
committed
add inlineStyles
1 parent 81782f8 commit 50a4973

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ interface ConfigEntry {
5555
`${__dirname}/tmp/devicon/icons/${entry.name}/${name}.svg`
5656
);
5757
const optimizedIcon = svgo.optimize(icon, {
58-
plugins: ["removeStyleElement"],
58+
plugins: [
59+
{
60+
name: "inlineStyles",
61+
params: {
62+
onlyMatchedOnce: false,
63+
},
64+
},
65+
"removeStyleElement",
66+
],
5967
}) as svgo.OptimizedSvg;
6068
const { document } = new JSDOM(optimizedIcon.data).window;
6169
const dir = `${__dirname}/tmp/dist/${entry.name}/${version}`;
@@ -112,10 +120,9 @@ module.exports = function ${reactName}({size = "1em", ${
112120
}
113121
}
114122
}
115-
return (${(await svgtojsx(svg.outerHTML)).replace(
116-
"<svg",
117-
"<svg {...props}"
118-
)});
123+
return (${(
124+
await svgtojsx(svg.outerHTML)
125+
).replace("<svg", "<svg {...props}")});
119126
}`
120127
);
121128
const definitions = `import React from "react";

0 commit comments

Comments
 (0)