Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minify z #34

Closed
KTibow opened this issue Nov 4, 2023 · 8 comments
Closed

Minify z #34

KTibow opened this issue Nov 4, 2023 · 8 comments

Comments

@KTibow
Copy link

KTibow commented Nov 4, 2023

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
@cyberalien
Copy link
Member

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.

@cyberalien cyberalien closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
@KTibow
Copy link
Author

KTibow commented Nov 12, 2023

This will be landing in the next version of svgo 🎉

@cyberalien
Copy link
Member

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>

@cyberalien
Copy link
Member

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

@KTibow
Copy link
Author

KTibow commented Nov 17, 2023

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

@cyberalien
Copy link
Member

Oh, right. Even better! Awesome!

@SethFalco
Copy link

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.

@cyberalien
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants