Svgo: Replace svg width,height with viewBox to make it responsive

Created on 3 Jul 2018  路  3Comments  路  Source: svg/svgo

Is it possible to replace svg width,height with viewBox?

for example
will be replaced with

Most helpful comment

This functionality is essential.

All 3 comments

I implemented a plugin which does this: https://github.com/guylando/svgo-addViewBox
You are welcome to add it to the official plugins list since its very useful to make svgs responsive when using them as an inline include (https://css-tricks.com/pretty-good-svg-icon-system/)

This functionality is essential.

It's more like image editing rather than optimization, so it's out of SVGO's scope.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdkjones picture bdkjones  路  3Comments

pixelass picture pixelass  路  3Comments

wuz picture wuz  路  3Comments

Roman52 picture Roman52  路  5Comments

niftylettuce picture niftylettuce  路  4Comments