Skip to content

Commit

Permalink
fix: svgo promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Aissaoui-Ahmed committed Dec 23, 2021
1 parent 5b3b86a commit e06f063
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/react-svg-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { transformSync as babelTransform } from "@babel/core";
import plugin from "babel-plugin-react-svg";
import Svgo from "svgo/lib/svgo/jsAPI";
import { optimize as svgOptimize } from "svgo";
import { validateAndFix } from "./svgo";


// SVGO Optimize
export function optimize(opts: any = {}): (content: string) => Promise<string> {
opts = validateAndFix(opts);
const svgo = new Svgo(opts);

return (content: string) => svgo.optimize(content).then(data => data.data);
export function optimize(opts: any = {}) {
const optionsValid = validateAndFix(opts)
const optimized = svgOptimize(optionsValid);
return optimized;
}

// Babel Transform
Expand Down

0 comments on commit e06f063

Please sign in to comment.