vscode-svg2 icon indicating copy to clipboard operation
vscode-svg2 copied to clipboard

Minify breaks events in begin attribute

Open sa-he opened this issue 3 years ago • 3 comments

The following input has two animations that trigger each other via the begin attribute.

<ellipse id="demo" cx="11.999911" cy="4" rx="4" ry="4" /> <animateTransform xlink:href="#demo" type="scale" id="a" attributeName="transform" begin="0s;b.end" dur="1s" from="1,1" to="1,0.5" /> <animateTransform xlink:href="#demo" type="scale" id="b" attributeName="transform" begin="a.end" dur="1s" from="1,0.5" to="1,1" />

This is the minified code which has broken references in the begin attribute -> hence a broken animation.

<circle id="prefix__a" cx="12" cy="4" r="4" /> <animateTransform xlink:href="#prefix__a" type="scale" id="prefix__c" attributeName="transform" begin="0s;b.end" dur="1s" from="1,1" to="1,0.5" /> <animateTransform xlink:href="#prefix__a" type="scale" id="prefix__b" attributeName="transform" begin="c.end" dur="1s" from="1,0.5" to="1,1" />

Is this the correct repo to post this kind of issues? The VS-Code Marketplace suggests, that this svg extension uses another library for minifying.

sa-he avatar Jun 17 '21 12:06 sa-he

At present, I have not found a better replacement for minified operations. If you know there is, please share it.

lishu avatar Jun 29 '21 13:06 lishu

If it's SVGO doing the minifying, isn't it just an issue of adding a svgo.config.js (to the workspace) with options to preserve certain things, like id's and attributes.

I almost always add an svgo,config.js that preserves the viewBox attribute for example.

jorismak avatar May 27 '22 13:05 jorismak

svgo config can be setting by svg.minify in your vscode settings.

lishu avatar May 28 '22 04:05 lishu