-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is your feature request related to a problem? Please describe.
The result, in, and in2 attributes in a filter chain are always left as-is. However, as far as I can tell, these attributes are scoped to the particular <filter> element they are inside of. Would it make sense to minify these attributes?
Describe the solution you'd like
These attributes should be minified to single letter names where possible, making sure to match up in/in2 attributes with the corresponding result. Also make sure not to change the special values SourceGraphic | SourceAlpha | BackgroundImage | BackgroundAlpha | FillPaint | StrokePaint
Describe alternatives you've considered
Writing my own svgo plugin.
Additional context
Here's an example svg exported from Figma using <filter>, run through svgo, and theresult/in/in2 attributes remaining unminified:
<svg width="42" height="42" fill="none" viewBox="0 0 42 42">
<g filter="url(#id-a)">
<path
fill="white"
d="M9 18c0-6.627 5.373-12 12-12s12 5.373 12 12-5.373 12-12 12H11a2 2 0 0 1-2-2z"
/>
<path
stroke="white"
d="M21 5.5c6.904 0 12.5 5.596 12.5 12.5S27.904 30.5 21 30.5H11A2.5 2.5 0 0 1 8.5 28V18c0-6.904 5.596-12.5 12.5-12.5Z"
/>
</g>
<path
fill="black"
d="M21 28v2H11v-2zm10-10c0-5.523-4.477-10-10-10s-10 4.477-10 10v12l-.204-.01a2 2 0 0 1-1.785-1.786L9 28V18c0-6.627 5.373-12 12-12s12 5.373 12 12-5.373 12-12 12v-2c5.523 0 10-4.477 10-10"
/>
<defs>
<filter
id="id-a"
width="42"
height="42"
x="0"
y="0"
color-interpolation-filters="sRGB"
filterUnits="userSpaceOnUse"
>
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feColorMatrix
in="SourceAlpha"
result="hardAlpha"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
/>
<feOffset dy="1" />
<feGaussianBlur stdDeviation="1.5" />
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" />
<feBlend in2="BackgroundImageFix" result="effect1_dropShadow_9843_4233" />
<feColorMatrix
in="SourceAlpha"
result="hardAlpha"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
/>
<feOffset dy="3" />
<feGaussianBlur stdDeviation="4" />
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" />
<feBlend
in2="effect1_dropShadow_9843_4233"
result="effect2_dropShadow_9843_4233"
/>
<feColorMatrix
in="SourceAlpha"
result="hardAlpha"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
/>
<feOffset />
<feGaussianBlur stdDeviation=".25" />
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.18 0" />
<feBlend
in2="effect2_dropShadow_9843_4233"
result="effect3_dropShadow_9843_4233"
/>
<feBlend
in="SourceGraphic"
in2="effect3_dropShadow_9843_4233"
result="shape"
/>
</filter>
</defs>
</svg>