|
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 | | - */ |
27 | 1 | module.exports = { |
28 | 2 | plugins: [ |
29 | 3 | { |
30 | 4 | name: 'preset-default', |
31 | 5 | params: { |
32 | 6 | overrides: { |
| 7 | + // Disable a plugin included by default that you don't want (false) |
33 | 8 | removeViewBox: false, |
34 | 9 | }, |
35 | 10 | }, |
36 | 11 | }, |
| 12 | + // Plugins that are not in the "preset-default" and that you want to activate |
37 | 13 | 'convertStyleToAttrs', |
38 | 14 | 'prefixIds', |
39 | 15 | ], |
|
0 commit comments