iconify/tools

Minify z

Closed this issue ยท 8 comments

Some icons are being shipped like this:

m7 10l5 5l5-5H7Z

In many cases this can be simplified to

m7 10l5 5l5-5Z

In the cases where a straight line isn't enough, this could still be simplified to

m7 10l5 5l5-5H7

While this would be a nice optimisation to have, I have no plans of doing something like that. It is an edge case, benefit is minimal at best, but it is not trivial to implement.

Then this is out of scope of this project. For most optimisations Iconify Tools use SVGO, without using few bugged plugins. It does have path rewriting function, but it is mostly for supporting legacy software, not for optimisations, actually it reverts optimisations.

Will it fix this icon?

<svg width="256" height="256" xmlns="http://www.w3.org/2000/svg">
    <path d="M32 32h192v192h-192v-192z" fill="none" stroke="black" stroke-width="8" />
</svg>

It won't because it accounts for stroke. Nice!

Actually it does (since there's already a z, it can convert v-192z to z)

Oh, right. Even better! Awesome!

Hey! Just noting that SVGO v3.0.4 has been released, which includes this optimization.
If you do run into any problems, please do just report an issue and I'll take a look ASAP. ๐Ÿ‘๐Ÿฝ

Thanks again KTibow for implementing it.

Ran new version of SVGO with path optimisation on icon sets, there is a noticeable difference in size.

Before: 321135393
After: 319271242

So about half of percent difference.

Nice!