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
@parcel/transformer-svgo removes viewBox
attribute
#4314
Comments
It seems to do this by default (tested with https://jakearchibald.github.io/svgomg/), { "plugins": [{ "removeViewBox": false }] } The (And pasting the two files into the issue would be enough as well, you don't have to create a repo everytime if you want 😄 ) |
Interesting. I could have sworn I tested with svgomg. @jakearchibald what do you think? Should removing
Believe it or not, this is currently easier for me :D |
That plugin should only run when Not sure why the plugin is actually removing |
Well, this is embarrassing: the The reason why my repro was misbehaving is because it says |
😄 |
I'm having this issue too, and the width and height are not the same as the width and height in the viewport. The original inline svg is:
The result from parcel 2.0.0-nightly.679 using
Note the removal of the viewBox, despite the width and height (24) not being the same as the viewBox width and height (16). |
The suggestion of adding a .svgorc with { "plugins": [{ "removeViewBox": false }] } doesn't solve this. Can I disable parcel's use of SVGO? If so, how would I do this? |
I assume that you aren't using SVGO yourself then (you have to specify a parcelrc config for that at the moment), but this happens via htmlnano (and your SVG is inside an HTML file). So adding a .htmlnanorc with
or outright
should work |
Yes – it did indeed work. Thank you for the hint.
|
I came across with this today, and none of these solutions mentioned above worked. Create a
Re-build the project and it should work now Update (Nov 24, 2022): |
🐛 bug report
@parcel/transformer-svgo removes
viewBox
attribute. This will drastically affect the visual of the resulting SVG.🎛 Configuration (.babelrc, package.json, cli command)
Please see repro repo
🤔 Expected Behavior
The SVG should be minified and still look the same than the original.
😯 Current Behavior
The
viewBox
attribute is removed, creating a different visual from the original.💁 Possible Solution
🔦 Context
Normal web development.
💻 Code Sample
Please see repro repo
🌍 Your Environment
The text was updated successfully, but these errors were encountered: