Skip to content

Commit eb5e0fa

Browse files
committed
fix svgo config comment
1 parent c5fb607 commit eb5e0fa

1 file changed

Lines changed: 2 additions & 26 deletions

File tree

config/svgo.config.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
1-
/**
2-
* SVGO 3+ config for imagemin-svgo / svgo-loader.
3-
*
4-
* Format: SVGO 3 rejects the v2 style `{ cleanupAttrs: true }` (no `name` on plugin objects).
5-
*
6-
* Why not list every plugin like the old file?
7-
* - SVGO 3 expects either named plugins or `preset-default`, which bundles most optimizers
8-
* (cleanupAttrs, removeComments, convertPathData, mergePaths, etc.) in a maintained order.
9-
* Duplicating that full list in v3 `{ name, params }` form would be long and redundant.
10-
* - Reference: https://svgo.dev/docs/preset-default/
11-
*
12-
* Mapping from the previous v2 `{ plugin: boolean }` list:
13-
* - `true` on a built-in → usually covered by `preset-default` (see link above).
14-
* - `false` falls into two cases in SVGO 3:
15-
* (A) Plugin is part of `preset-default` → turn it off with `params.overrides`
16-
* (e.g. `removeViewBox: false` below — removeViewBox runs inside the preset by default).
17-
* (B) Plugin is optional / not in the preset → do not list it; SVGO only runs plugins you
18-
* declare. So “false” in v2 = omit the plugin name here.
19-
* Examples from the old config:
20-
* - removeDimensions: https://svgo.dev/docs/plugins/removeDimensions/ — optional; not in
21-
* `preset-default`; we omit it so width/height stay (unless you add `'removeDimensions'`).
22-
* - removeRasterImages: https://svgo.dev/docs/plugins/removeRasterImages/ — optional;
23-
* not in `preset-default`; we omit it so embedded rasters are kept.
24-
* - Extra plugins the old list enabled but preset does not include:
25-
* `convertStyleToAttrs`, `prefixIds` — listed explicitly below (sprites / ID stability).
26-
*/
271
module.exports = {
282
plugins: [
293
{
304
name: 'preset-default',
315
params: {
326
overrides: {
7+
// Disable a plugin included by default that you don't want (false)
338
removeViewBox: false,
349
},
3510
},
3611
},
12+
// Plugins that are not in the "preset-default" and that you want to activate
3713
'convertStyleToAttrs',
3814
'prefixIds',
3915
],

0 commit comments

Comments
 (0)