Skip to content

Commit

Permalink
feat(config): add themeDir option
Browse files Browse the repository at this point in the history
  • Loading branch information
Waleed-KH committed Jan 4, 2024
1 parent d279e63 commit 2aefd57
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/reference/site-config.md
Expand Up @@ -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))[]`
Expand Down
5 changes: 4 additions & 1 deletion src/node/config.ts
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/node/siteConfig.ts
Expand Up @@ -64,6 +64,7 @@ export interface UserConfig<ThemeConfig = any>
outDir?: string
assetsDir?: string
cacheDir?: string
themeDir?: string

shouldPreload?: (link: string, page: string) => boolean

Expand Down

0 comments on commit 2aefd57

Please sign in to comment.