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

removeViewBox doesn't seem to remove viewbox #1482

Closed
kalnode opened this issue Jun 1, 2021 · 2 comments
Closed

removeViewBox doesn't seem to remove viewbox #1482

kalnode opened this issue Jun 1, 2021 · 2 comments
Labels

Comments

@kalnode
Copy link

kalnode commented Jun 1, 2021

Describe the bug
The plugin removeViewBox doesn't seem to remove the viewbox. I've tried a few tests.

To Reproduce
1 - Prepare an svg with viewbox defined.
2 - Run svgo with the plugin removeViewBox enabled
3 - Observe viewbox still exists in the svg output

Expected behavior
Viewbox should be removed if using this plugin.

Desktop (please complete the following information):

  • SVGO Version 2.0.3
  • NodeJs Version 14.16
  • OS: Ubuntu 20.10

Additional context

FYI, viewbox is pretty important, and most people probably never want to remove it. However, this plugin, if it should continue to exist, should at least do what it describes.

There is a related discussion about viewbox here: #1461

@kalnode kalnode added the bug label Jun 1, 2021
@kalnode kalnode changed the title removeViewBox doesn't seem to do anything? removeViewBox doesn't seem to remove viewbox Jun 1, 2021
@ryanb
Copy link

ryanb commented Jun 2, 2021

The removeViewBox plugin is working for me in svgo 2.3.0. A little too well because I wish it didn't!

I believe it only works when the viewBox matches the width and height attributes. Is this the case in your test?

@SethFalco
Copy link
Member

Indeed ryanb is correct. The plugin only removes the viewBox attribute when the SVG height and width are the same as the ones defined in the viewbox.

See: https://svgo.dev/docs/plugins/remove-viewbox/

As there hasn't been a response from the original poster, I'll treat this as a documentation task which has already been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants