SVGs are cropped upon deployment
gthayer opened this issue · comments
Gary Thayer commented
Describe the bug
When npm run build
is run, SVGs have their "viewbox" attribute removed which causes cropping:
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
- If you site has SVGs, run
npm run build
to see the cropping npm run watch
does not include the cropping becauseImageminPlugin
is disabled on non-production environments,.
Expected behavior
No cropping
Gary Thayer commented
Created a PR here: #131
This also applied to the theme scaffold, so I created a ticket over there too: 10up/theme-scaffold#206