From f4355c7cd3a208ed41953f40863b15d85f2c3e96 Mon Sep 17 00:00:00 2001 From: John Campion Jr Date: Mon, 27 Mar 2023 13:56:37 -0400 Subject: [PATCH] docs: add info about getting config in loaders (#2147) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- docs/guide/data-loading.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/guide/data-loading.md b/docs/guide/data-loading.md index c7f7c8e69696..a2d1405c360a 100644 --- a/docs/guide/data-loading.md +++ b/docs/guide/data-loading.md @@ -193,3 +193,13 @@ export default defineLoader({ } }) ``` + +## Configuration + +To get the configuration information inside a loader, you can use some code like this: + +```ts +import type { SiteConfig } from 'vitepress' + +const config: SiteConfig = (globalThis as any).VITEPRESS_CONFIG +```