Fix optimizeSvgs script (#160)

This commit is contained in:
Christopher Sandvik
2020-12-30 14:23:46 -05:00
committed by GitHub
parent cf13cef475
commit fc2fac9ca4
4 changed files with 5 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ function processSvg(svg) {
return (
optimize(svg)
.then(setAttrs)
.then(format)
.then(optimizedSvg => format(optimizedSvg, { parser: 'babel' }))
// remove semicolon inserted by prettier
// because prettier thinks it's formatting JSX not HTML
.then(svg => svg.replace(/;/g, ''))
@@ -36,9 +36,7 @@ function optimize(svg) {
],
});
return new Promise(resolve => {
svgo.optimize(svg, ({ data }) => resolve(data));
});
return svgo.optimize(svg).then(({ data }) => data);
}
/**