Skip to content

Disable stripping viewBox #735

Answered by tremby
tremby asked this question in Q&A
Jul 20, 2018 · 19 comments · 9 replies
Discussion options

You must be logged in to vote

Thanks, that got me on the right lines. That didn't work for me (I may have made a typo) but I saw in the options I can do a YAML file instead. I ended up writing a file .svgo.yml with the following contents:

plugins:
  - removeViewBox: false

Edit in 2025:

It seems the above no longer works with newer versions of the library ("Error: Plugin name should be specified"), and what works for me now is this, in a .svgo.yml file in my project root:

plugins:
  -
    name: preset-default
    params:
      overrides:
        removeViewBox: false

Still no need to add any special configuration in other places, for example in Webpack configuration.

Replies: 19 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@RampantDespair
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@doctor-kat
Comment options

Answer selected by tremby
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Rhut-virani
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@saltire
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@WesleyKapow
Comment options

@LiamWinterton
Comment options

@Natsunokazeme
Comment options

@wonathanjong
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tremby
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #142 on June 19, 2022 19:39.