You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have multiple SVGs that contain repeated identical elements. For example, a map with a symbol reused in multiple places. However, the SVG file contains the element for each symbol separately, even though they are identical (just translated).
SVGO to identify repeated elements of the SVG, extract them into a <defs><symbols> and then replace their usage with a shorter <use>.
For example:
<svgviewBox="0 0 80 20"xmlns="http://www.w3.org/2000/svg">
<!-- Our symbol in its own coordinate system -->
<symbolid="myDot"width="10"height="10"viewBox="0 0 2 2">
<circlecx="1"cy="1"r="1" />
</symbol>
<!-- All instances of our symbol -->
<usehref="#myDot"x="5"y="5" />
<usehref="#myDot"x="20"y="5" />
<usehref="#myDot"x="35"y="5" />
<usehref="#myDot"x="50"y="5" />
<usehref="#myDot"x="65"y="5" />
</svg>
(Ok my example makes it look longer, but imagine the symbol being more complex)
Describe alternatives you've considered
The software that generated the SVGs could be adapted to do this. I've recently done this by hand for a couple of images, and it reduced my file considerabile. I've also not confirmed this, but in theory the SVG could render faster when it has to repeat the same symbol.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I have multiple SVGs that contain repeated identical elements. For example, a map with a symbol reused in multiple places. However, the SVG file contains the element for each symbol separately, even though they are identical (just translated).
For example
Describe the solution you'd like
SVGO to identify repeated elements of the SVG, extract them into a
<defs><symbols>
and then replace their usage with a shorter<use>
.For example:
(Ok my example makes it look longer, but imagine the symbol being more complex)
Describe alternatives you've considered
The software that generated the SVGs could be adapted to do this. I've recently done this by hand for a couple of images, and it reduced my file considerabile. I've also not confirmed this, but in theory the SVG could render faster when it has to repeat the same symbol.
The text was updated successfully, but these errors were encountered: