-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Bloats and Mangles SVGs in Data URIs #243
Comments
Not sure what you mean, if I run the online too it becomes 425B, which is smaller. Whether you use base64 is irrelevant by the way, the minifier chooses whichever is smaller, and yes it does use the mentioned article (which is quite old). Can you explain what you mean with mangled SVGs? Is the resulting SVG image looking bad? |
I think the misunderstanding here is what I shared is CSS with embedded SVG. It is parsed as CSS and the SVG is mangled. Just pop it into the minifer and choose CSS or, alternatively, wrap in a In order to resolve this the parser needs to know when to switch over to SVG when they're embedded in a data URI. The MIME type is there so it should be doable. |
This is a duplicate of #180 |
…ugfix where it could choose a longer ASCII over a shorter base64
Consider the following style rule I use to style external links:
That's an optimized SVG already. It doesn't get much smaller than that.
Now run that code through the online minifier tool and notice...
The output is larger than the input. Okay, that seems strange for a minification tool but I get that not everyone is using optimized SVGs in Data URIs yet.
But that's not the problem. The problem is that the tool under default settings (AFAIK) mangles the image by trying to base64 encode it. You can't do that with SVGs because they may be styled as part of the cascade.
The text was updated successfully, but these errors were encountered: