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

Run SVGs through SVGO with most aggressive settings #1690

Merged
merged 2 commits into from
Jun 17, 2019
Merged

Run SVGs through SVGO with most aggressive settings #1690

merged 2 commits into from
Jun 17, 2019

Conversation

lencioni
Copy link
Contributor

@lencioni lencioni commented Jun 17, 2019

I noticed that these SVGs could be optimized a little more, by reducing
the precision. The end result is slightly different, but at the size
they are used, I don't think it will really be perceptible.

I left close.svg alone because it has a 12x12 viewBox instead of a
1000x1000 viewbox, so the precision here is actually pretty important
for the shape.

I think some more bytes could maybe be squeezed out of these by
recreating them from hand using different shapes instead of paths, but
that's a bit more work than I'd like to do at this time.

This optimization reduces the size of the svg directory from 2678 bytes
to 2106 bytes.

Screenshots before:

image

image

image

image

Screenshots after:

image

image

image

image

lencioni added 2 commits June 17, 2019 10:28
I noticed that these SVGs could be optimized a little more, by reducing
the precision. The end result is slightly different, but at the size
they are used, I don't think it will really be perceptible.

I left close.svg alone because it has a 12x12 viewBox instead of a
1000x1000 viewbox, so the precision here is actually pretty important
for the shape.

I think some more bytes could maybe be squeezed out of these by
recreating them from hand using different shapes instead of paths, but
that's a bit more work than I'd like to do at this time.

This optimization reduces the size of the svg directory from 2678 bytes
to 2106 bytes.
I found that I can squeeze out a few extra bytes in this SVG by running
it through svgcleaner.
@lencioni lencioni requested review from ljharb, majapw and nkinser June 17, 2019 17:40
@ljharb
Copy link
Member

ljharb commented Jun 17, 2019

Can you share a visual diff? 500bytes is pretty tiny.

@lencioni
Copy link
Contributor Author

lencioni commented Jun 17, 2019

@ljharb I've added some screenshots.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add ci that fails if any non-safelisted svgs ran through svgo generate a git diff?

@lencioni
Copy link
Contributor Author

@ljharb probably not worth the effort. Also, svgo removes the focusable attribute which I had to manually add back in.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.14% when pulling 32de430 on svgo into bf7e334 on master.

@lencioni lencioni merged commit 32de430 into master Jun 17, 2019
@lencioni lencioni deleted the svgo branch June 17, 2019 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants