diff options
Diffstat (limited to '.changeset/cold-schools-yell.md')
-rw-r--r-- | .changeset/cold-schools-yell.md | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/.changeset/cold-schools-yell.md b/.changeset/cold-schools-yell.md deleted file mode 100644 index 7d6b4f381..000000000 --- a/.changeset/cold-schools-yell.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -'astro': minor ---- - -Support adding integrations dynamically - -Astro integrations can now themselves dynamically add and configure additional integrations during set-up. This makes it possible for integration authors to bundle integrations more intelligently for their users. - -In the following example, a custom integration checks whether `@astrojs/sitemap` is already configured. If not, the integration adds Astro’s sitemap integration, passing any desired configuration options: - -```ts -import sitemap from '@astrojs/sitemap'; -import type { AstroIntegration } from 'astro'; - -const MyIntegration = (): AstroIntegration => { - return { - name: 'my-integration', - - 'astro:config:setup': ({ config, updateConfig }) => { - // Look for sitemap in user-configured integrations. - const userSitemap = config.integrations.find( - ({ name }) => name === '@astrojs/sitemap' - ); - - if (!userSitemap) { - // If sitemap wasn’t found, add it. - updateConfig({ - integrations: [sitemap({ /* opts */ }], - }); - } - }, - }; -}; -``` |