From 430494c54983923790bfbf432bc6e26432b1247a Mon Sep 17 00:00:00 2001 From: sebastien Date: Thu, 14 Nov 2024 17:58:50 +0100 Subject: [PATCH] docs --- website/docs/api/plugins/overview.mdx | 3 ++ website/docs/api/plugins/plugin-svgr.mdx | 55 ++++++++++++++++++++++++ website/docs/using-plugins.mdx | 3 ++ 3 files changed, 61 insertions(+) create mode 100644 website/docs/api/plugins/plugin-svgr.mdx diff --git a/website/docs/api/plugins/overview.mdx b/website/docs/api/plugins/overview.mdx index 651517d4ee83..23eb70892996 100644 --- a/website/docs/api/plugins/overview.mdx +++ b/website/docs/api/plugins/overview.mdx @@ -23,8 +23,11 @@ These plugins will add a useful behavior to your Docusaurus site. - [@docusaurus/plugin-debug](./plugin-debug.mdx) - [@docusaurus/plugin-sitemap](./plugin-sitemap.mdx) +- [@docusaurus/plugin-svgr](./plugin-svgr.mdx) +- [@docusaurus/plugin-rsdoctor](./plugin-rsdoctor.mdx) - [@docusaurus/plugin-pwa](./plugin-pwa.mdx) - [@docusaurus/plugin-client-redirects](./plugin-client-redirects.mdx) - [@docusaurus/plugin-ideal-image](./plugin-ideal-image.mdx) - [@docusaurus/plugin-google-analytics](./plugin-google-analytics.mdx) - [@docusaurus/plugin-google-gtag](./plugin-google-gtag.mdx) +- [@docusaurus/plugin-google-tag-manager](./plugin-google-tag-manager.mdx) diff --git a/website/docs/api/plugins/plugin-svgr.mdx b/website/docs/api/plugins/plugin-svgr.mdx new file mode 100644 index 000000000000..bd5bef1eab90 --- /dev/null +++ b/website/docs/api/plugins/plugin-svgr.mdx @@ -0,0 +1,55 @@ +--- +sidebar_position: 7 +slug: /api/plugins/@docusaurus/plugin-svgr +--- + +# 📦 plugin-svgr + +import APITable from '@site/src/components/APITable'; + +An [SVGR](https://react-svgr.com/) plugin to transform SVG files into React components automatically at build time. + +## Installation {#installation} + +```bash npm2yarn +npm install --save @docusaurus/plugin-svgr +``` + +:::tip + +If you use the preset `@docusaurus/preset-classic`, you don't need to install this plugin as a dependency. + +You can configure this plugin through the [preset options](../../using-plugins.mdx#docusauruspreset-classic). + +::: + +## Configuration {#configuration} + +Accepted fields: + +```mdx-code-block + +``` + +| Name | Type | Default | Description | +| --- | --- | --- | --- | +| `svgrConfig` | `object` | `{}` | The [SVGR config options](https://react-svgr.com/docs/options/), forwarded as is | + +```mdx-code-block + +``` + +### Example configuration {#ex-config} + +You can configure this plugin through plugin options. + +```js config-tabs +// Preset Options: svgr +// Plugin Options: @docusaurus/plugin-svgr + +const config = { + svgrConfig: { + /* SVGR config */ + }, +}; +``` diff --git a/website/docs/using-plugins.mdx b/website/docs/using-plugins.mdx index 92d86097d717..a9d7f043243b 100644 --- a/website/docs/using-plugins.mdx +++ b/website/docs/using-plugins.mdx @@ -148,6 +148,7 @@ The classic preset is shipped by default to new Docusaurus websites created with - [`@docusaurus/plugin-google-tag-manager`](./api/plugins/plugin-google-tag-manager.mdx) - [`@docusaurus/plugin-google-analytics`](./api/plugins/plugin-google-analytics.mdx) (**deprecated**) - [`@docusaurus/plugin-sitemap`](./api/plugins/plugin-sitemap.mdx) +- [`@docusaurus/plugin-svgr`](./api/plugins/plugin-svgr.mdx) The classic preset will relay each option entry to the respective plugin/theme. @@ -171,6 +172,8 @@ export default { pages: {}, // Will be passed to @docusaurus/plugin-sitemap (false to disable) sitemap: {}, + // Will be passed to @docusaurus/plugin-svgr (false to disable) + svgr: {}, // Will be passed to @docusaurus/plugin-google-gtag (only enabled when explicitly specified) gtag: {}, // Will be passed to @docusaurus/plugin-google-tag-manager (only enabled when explicitly specified)