-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 strips styles #1077
Comments
You can turn off the inline styles option to keep them. Worked with your example.
|
@ossinkine, @popbee: Disabling the |
Neither of these approaches worked for me unfortunately. I am using Test case: |
@cneeson: It is probable that the |
@strarsis thanks for getting back. Think I have confirmed that the options aren't being passed to |
@cneeson: So you have to find out what part of your webpack setup doesn't pass the options to |
@ossinkine, @cneeson: Were you able to fix the issue? |
@strarsis No, we just slightly modified the svgs so that svgo processes them correctly. |
I've disabled |
@alexeychikk: Are you sure that those plugins are really disabled? |
Stripped down SVG for reproducing the issue: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.49 35.68">
<defs>
<style>
.wrapper.cls-1 {
isolation: isolate;
}
.wrapper .some-stroke {
stroke: #e8ce3a;
}
</style>
</defs>
<g class="wrapper cls-1">
<polyline class="some-stroke" points="22.75 22.2 8.43 7.18 13.4 1.9 32.09 1.9 37.06 7.18 22.75 22.2 17.9 10.27 17.96 7.18"/>
<polyline class="some-stroke" points="22.75 22.2 27.38 10.27 27.38 7.18"/>
</g>
</svg>
It only happens with classes that are used more than once, hence the issue with Edit: So the reason for this is that when a selector is inlined, the element class is also stripped, if configured to do so. |
Thanks for reporting the issue, and thanks to strarsis for investigating it. |
svgs.zip
Before.svg contains styles for shapes but after SVGO processing it does not contain them anymore and also shapes do not contain according attributes.
The text was updated successfully, but these errors were encountered: