From 75dc22b4fbe2cecae0265ca3d0c18b3a3415d33f Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Mon, 5 May 2025 17:27:55 +0100 Subject: [PATCH] docs: add migration guide for svgo v4 (#2119) --- docs/01-index.mdx | 2 +- docs/02-usage/01-node.mdx | 27 ---- docs/02-usage/02-browser.mdx | 20 --- ...oveScriptElement.mdx => removeScripts.mdx} | 0 .../01-migration-from-v3-to-v4.mdx | 138 ++++++++++++++++++ docs/06-migrations/_category_.json | 3 + 6 files changed, 142 insertions(+), 48 deletions(-) rename docs/04-plugins/{removeScriptElement.mdx => removeScripts.mdx} (100%) create mode 100644 docs/06-migrations/01-migration-from-v3-to-v4.mdx create mode 100644 docs/06-migrations/_category_.json diff --git a/docs/01-index.mdx b/docs/01-index.mdx index cacacf83..71e378c8 100644 --- a/docs/01-index.mdx +++ b/docs/01-index.mdx @@ -11,7 +11,7 @@ SVG files, especially those exported from vector editors, usually contain a lot ### System Requirements -- [Node.js 16](https://nodejs.org/) or later +- [Node.js >=16](https://nodejs.org/) diff --git a/docs/02-usage/01-node.mdx b/docs/02-usage/01-node.mdx index 25e6a39c..e73b88f2 100644 --- a/docs/02-usage/01-node.mdx +++ b/docs/02-usage/01-node.mdx @@ -22,30 +22,3 @@ const { data } = optimize(svg); console.log(data); // •ᴗ• ``` - -## Exports - -
-
- VERSION -
-
Version of SVGO during runtime.
-
- builtinPlugins -
-
- Array of built-in plugins, including plugins that are disabled by default - and any presets. -
-
- optimize(svgCode, svgoConfig) -
-
Invokes the optimization and returns the optimized/minified SVG code.
-
- loadConfig(configFile, directory) -
-
- Utility to find the nearest svgo.config.js file by searching up - the parent directories. -
-
diff --git a/docs/02-usage/02-browser.mdx b/docs/02-usage/02-browser.mdx index 826844a8..bb553f21 100644 --- a/docs/02-usage/02-browser.mdx +++ b/docs/02-usage/02-browser.mdx @@ -62,23 +62,3 @@ Here's a minimal example: ``` - -## Exports - -
-
- VERSION -
-
Version of SVGO during runtime.
-
- builtinPlugins -
-
- Array of built-in plugins, including plugins that are disabled by default - and any presets. -
-
- optimize(svgCode, svgoConfig) -
-
Invokes the optimization and returns the optimized/minified SVG code.
-
diff --git a/docs/04-plugins/removeScriptElement.mdx b/docs/04-plugins/removeScripts.mdx similarity index 100% rename from docs/04-plugins/removeScriptElement.mdx rename to docs/04-plugins/removeScripts.mdx diff --git a/docs/06-migrations/01-migration-from-v3-to-v4.mdx b/docs/06-migrations/01-migration-from-v3-to-v4.mdx new file mode 100644 index 00000000..b2388f9d --- /dev/null +++ b/docs/06-migrations/01-migration-from-v3-to-v4.mdx @@ -0,0 +1,138 @@ +--- +title: Migration from v3 to v4 +slug: 'migration-from-v3-to-v4' +--- + +This is a summary of the changes necessary to migrate from SVGO v3 to SVGO v4. If you want more details or have any questions, please refer to our [release notes for SVGO v4.0.0](https://github.com/svg/svgo/releases/tag/v4.0.0) or related pull requests. You're also encouraged to leave comments in pull requests if the existing content doesn't already answer your question. + +## Version Requirements + +SVGO now requires [Node.js >=16.0.0](https://nodejs.org/en/blog/release/v16.0.0). + +## Default Behavior + +The following changes have been made to default plugins, also known as [preset-default](/docs/preset-default/). + +- **[removeViewBox](/docs/plugins/removeViewBox/)** is no longer a default plugin, to preserve scalability. +- **[removeTitle](/docs/plugins/removeTitle)** is no longer a default plugin, to preserve accessibility. +- **removeScriptElement** has been renamed to **[removeScripts](/docs/plugins/removeScripts)**, as it not only removes the `