Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

SVGs are cropped upon deployment #130

Open
gthayer opened this issue Nov 24, 2020 · 1 comment
Open

SVGs are cropped upon deployment #130

gthayer opened this issue Nov 24, 2020 · 1 comment
Labels

Comments

@gthayer
Copy link

gthayer commented Nov 24, 2020

Describe the bug
When npm run build is run, SVGs have their "viewbox" attribute removed which causes cropping:

image

This is caused in plugin-scaffold/config/webpack.config.common.js. ImageminPlugin can be updated to this to correct it:

		// Compress images
		// Must happen after CopyWebpackPlugin
		new ImageminPlugin({
			disable: !isProduction,
			test: settings.ImageminPlugin.test,
			svgo: {
				plugins: [
					{
						removeViewBox: false,
					},
				],
			},
		}),

Steps to Reproduce

  1. If you site has SVGs, run npm run build to see the cropping
  2. npm run watch does not include the cropping because ImageminPlugin is disabled on non-production environments,.

Expected behavior
No cropping

@gthayer
Copy link
Author

gthayer commented Nov 24, 2020

Created a PR here: #131

This also applied to the theme scaffold, so I created a ticket over there too: 10up/theme-scaffold#206

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

No branches or pull requests

1 participant