-
-
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
removes viewBox Attribute #505
Comments
|
@GreLI got the same issue with gulp-svgmin. My config looks like:
|
For those experiencing this issue, make sure that the |
Sorry, I cannot reproduce. If problem still persist try reduce to minimal test case. E.g.
doesn't remove |
i updated and experienced the same issue with at least this file:
@GreLI |
It is removed by default since v1.0.0, so it's normal. |
(I landed here because my |
I just experienced this issue with an svg which had |
@GreLI using the reduced test case above, if I want to preserve the viewbox but remove the width/height attributes, I would expect this to be the correct approach:
but the output (using svgo v1.1.1) is the following:
Am I doing something wrong? Or is this a bug with svgo? |
@jonmilner You want those as two different plugin options:
produces
|
Hopefully this explanation helps some folks:
For me, setting it to false and making sure my attributes are camel-cased took care of it. |
mrwweb is right. I'm experiencing the same issue that I need my svg can be scaled in html, removing viewBox and keeping dimensions break the scales. |
Hello, I believe I'm seeing a regression on this issue, using
Test case shown below. Note that the INPUT:
OUTPUT:
As suggested in #1128, the current workaround requires disabling the plugin as a default, like so:
As you can imagine, this is not ideal. |
Hi @samuelgoff. There was never an option called "removeViewBox". All comments above suggested disabling plugin. In v2 format of plugins was changed though. |
I managed to remove it with:
|
I was banging my head for two hours straight. You saved me, I thought my whole project is cursed. Just a reminder for everybody else: make sure that the |
I use gulp-imagemin to optimize svg files. But everytime the viewBox gets deleted even if I explicit define that they shouldnt be removed, like seen below.
imagemin({ svgoPlugins: [{removeViewBox: false}] })
The text was updated successfully, but these errors were encountered: