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

SVGO messes SVGs #1183

Closed
Hlsgs opened this issue Oct 31, 2019 · 2 comments
Closed

SVGO messes SVGs #1183

Hlsgs opened this issue Oct 31, 2019 · 2 comments

Comments

@Hlsgs
Copy link

Hlsgs commented Oct 31, 2019

I'm using SVGO though "grunt-contrib-imagemin". I've reverted to an earlier package.json and package-lock.json that installs SVGO 1.2.2 and everything is fine, so the regression must have creeped up after that version.

Here is an example before/after that was already optimized multiple times with no issue with versions <= 1.2.2. Now I just ran my build process with 1.3.2 and it got ruined:

Before:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111.946 75.259"><path id="img" d="M262.946 1229.358H151V1154.1h111.946zm-9.328-65.846h-93.29v37.622l23.322-23.517 27.841 26.018 21.137-18.8 20.99 19.43zm0 51.727l-21.141-18.946-20.844 18.946-28.123-26-23.176 23.37v7.341h93.29v-4.706zm-41.981-23.5a9.407 9.407 0 1 1 9.329-9.412 9.444 9.444 0 0 1-9.329 9.409z" transform="translate(-151 -1154.099)" fill="#fff" fill-rule="evenodd"/></svg>

After:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111.946 75.259"><path id="img" d="M262.946 1229.358H151V1154.1h111.946zm-9.328-65.846h-93.29v37.622l23.322-23.517 27.841 26.018 21.137-18.8 20.99 19.43zm0 51.727l-21.141-18.946-20.844 18.946-28.123-26-23.176 23.37v7.341h93.29v-4.706zm-41.981-23.5a9.407 9.407 0 119.329-9.412 9.444 9.444 0 01-9.329 9.409z" transform="translate(-151 -1154.099)" fill="#fff" fill-rule="evenodd"/></svg>

The problem seems to be changing 9.407 0 1 1 9.329-9.412 to 9.407 0 119.329-9.41

Thank you!

@GreLI
Copy link
Member

GreLI commented Nov 2, 2019

What viewer do you use? It's a valid optimization, introduced in v1.3. Whitespace is optional after arcto flags, it's in SVG 1 specification. However, as always, you can turn it off as described in #1137 (comment).

@Hlsgs
Copy link
Author

Hlsgs commented Nov 2, 2019

You are correct in assuming modern viewers(Firefox, Chrome) view the result properly, but up to date Illustrator outright fails to understand the optimized result(you can check the example I gave). Does Illustator have a non-conformant SVG engine?

Regardless, I've disabled this optimization and everything is fine with my projects, so thank you for pointing me in that direction.

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

No branches or pull requests

2 participants