10up / plugin-scaffold

DEPRECATED. Use https://github.com/10up/wp-scaffold

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVGs are cropped upon deployment

gthayer opened this issue · comments

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

Created a PR here: #131

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