feat(config): add `themeDir` option

pull/3291/head
Waleed Khaled 7 months ago
parent 6461f5d42b
commit b124ebc888

@ -437,6 +437,19 @@ export default {
}
```
### themeDir
- Type: `string`
- Default: `./.vitepress/theme` if exists, otherwise [Default Theme](../guide/extending-default-theme) path.
The directory of the [theme entry file](../guide/custom-theme#theme-resolving), relative to [project root](../guide/routing#root-and-source-directory).
```ts
export default {
themeDir: './awesome-theme'
}
```
### ignoreDeadLinks
- Type: `boolean | 'localhostLinks' | (string | RegExp | ((link: string) => boolean))[]`

@ -97,7 +97,10 @@ export async function resolveConfig(
}
// resolve theme path
const userThemeDir = resolve(root, 'theme')
const userThemeDir = userConfig.themeDir
? normalizePath(path.resolve(root, userConfig.themeDir))
: resolve(root, 'theme')
const themeDir = (await fs.pathExists(userThemeDir))
? userThemeDir
: DEFAULT_THEME_PATH

@ -64,6 +64,7 @@ export interface UserConfig<ThemeConfig = any>
outDir?: string
assetsDir?: string
cacheDir?: string
themeDir?: string
shouldPreload?: (link: string, page: string) => boolean

Loading…
Cancel
Save