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

Can't turn off removeViewBox #295

Open
oatmeaI opened this issue Mar 12, 2020 · 5 comments
Open

Can't turn off removeViewBox #295

oatmeaI opened this issue Mar 12, 2020 · 5 comments

Comments

@oatmeaI
Copy link

oatmeaI commented Mar 12, 2020

This config still removes the viewBox attribute from SVGs loaded with react-svg-loader. Why is that?

options: {
	svgo: {
		plugins: [
			{
				convertPathData: { noSpaceAfterFlags: false },
				removeViewBox: false,
			},
		],
	},
},
@peterkrieg
Copy link

@kvillaniholland curious did you ever find a fix? 🙏

@oatmeaI
Copy link
Author

oatmeaI commented Apr 3, 2020

No - what I ended up doing was changing the viewBox on the particular SVG that was breaking from 0 0 24 24 to 1 0 24 24 - the change was almost imperceptible, but the 1 stopped removeViewBox from removing the property.

@peterkrieg
Copy link

Ah I see, thanks - I actually ended up just using svgr/webpack instead

@oatmeaI
Copy link
Author

oatmeaI commented Apr 13, 2020

if anyone else comes across this, it was my fault; the config should have been:

options: {
	svgo: {
		plugins: [
			{ convertPathData: { noSpaceAfterFlags: false } },
			{ removeViewBox: false },
		],
	},
},

@SilviaRebelo-Which
Copy link

@kvillaniholland solution worked for me 🙌🏻

@lagunovsky lagunovsky mentioned this issue Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants