Skip to content

Commit ecb4312

Browse files
authored
Merge pull request #522 from BeAPI/fix/svgo-minimizer-svg-filter
fix(build): production SVGO for SVG assets and stable icon sprites
2 parents 0e66943 + 5360ce6 commit ecb4312

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎config/svgo.config.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ module.exports = {
99
},
1010
'removeTitle',
1111
'convertStyleToAttrs',
12-
'prefixIds',
1312
],
1413
}

‎config/webpack.common.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module.exports = {
1515
optimization: {
1616
minimizer: [
1717
new ImageMinimizerPlugin({
18+
// svg-sprite-loader extract publicPath; sprites are already optimized via svgo-loader.
19+
exclude: /(?:^|[/\\])icons[/\\]/i,
1820
minimizer: [
1921
{
2022
implementation: ImageMinimizerPlugin.sharpMinify,
@@ -44,6 +46,7 @@ module.exports = {
4446
},
4547
{
4648
implementation: ImageMinimizerPlugin.svgoMinify,
49+
filter: (source, sourcePath) => /\.svg$/i.test(sourcePath),
4750
options: {
4851
encodeOptions: {
4952
multipass: true,

0 commit comments

Comments
 (0)