Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): add themeDir option #3291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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