plugin-scaffold icon indicating copy to clipboard operation
plugin-scaffold copied to clipboard

SVGs are cropped upon deployment

Open gthayer opened this issue 5 years ago • 1 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

gthayer avatar Nov 24 '20 20:11 gthayer

Created a PR here: https://github.com/10up/plugin-scaffold/pull/131

This also applied to the theme scaffold, so I created a ticket over there too: https://github.com/10up/theme-scaffold/issues/206

gthayer avatar Nov 24 '20 21:11 gthayer