From 775a19b71f4fb3356d3039db320e943bd06ca02f Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Fri, 19 Feb 2021 00:44:56 +0100 Subject: [PATCH] Use new SVGO API --- source/app/metrics/index.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/app/metrics/index.mjs b/source/app/metrics/index.mjs index 284b3e81..76ed26e4 100644 --- a/source/app/metrics/index.mjs +++ b/source/app/metrics/index.mjs @@ -65,8 +65,13 @@ //Optimize rendering if ((conf.settings?.optimize)&&(!q.raw)) { console.debug(`metrics/compute/${login} > optimize`) - const svgo = new SVGO({full:true, plugins:[{cleanupAttrs:true}, {inlineStyles:false}]}) - const {data:optimized} = await svgo.optimize(rendered) + const {data:optimized} = await SVGO.optimize(rendered, {multipass:true, plugins:SVGO.extendDefaultPlugins([ + {name:"cleanupAttrs"}, + {name:"inlineStyles", active:false}, + {name:"cleanupListOfValues"}, + {name:"removeRasterImages"}, + {name:"removeScriptElement"}, + ])}) rendered = optimized } //Verify svg