Skip to content

Commit 5b04bb9

Browse files
authored
feat: user configurable outDir (#448)
1 parent fb6a4ad commit 5b04bb9

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
dist
88
node_modules
99
TODOs.md
10-
.vscode
10+
.vscode
11+
.idea

docs/guide/deploy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ deploy:
136136

137137
If you are deploying to `https://<USERNAME or GROUP>.gitlab.io/<REPO>/`, for example your repository is at `https://gitlab.com/<USERNAME>/<REPO>`, then set `base` to `'/<REPO>/'`.
138138

139-
2. Set `dest` in `.vitepress/config.js` to `public`.
139+
2. Set `outDir` in `.vitepress/config.js` to `../public`.
140140

141141
3. Create a file called `.gitlab-ci.yml` in the root of your project with the content below. This will build and deploy your site whenever you make changes to your content:
142142

src/node/config.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface UserConfig<ThemeConfig = any> {
3838
locales?: Record<string, LocaleConfig>
3939
markdown?: MarkdownOptions
4040
/**
41-
* Opitons to pass on to `@vitejs/plugin-vue`
41+
* Options to pass on to `@vitejs/plugin-vue`
4242
*/
4343
vue?: VuePluginOptions
4444
/**
@@ -48,6 +48,7 @@ export interface UserConfig<ThemeConfig = any> {
4848

4949
srcDir?: string
5050
srcExclude?: string[]
51+
outDir?: string
5152
shouldPreload?: (link: string, page: string) => boolean
5253

5354
/**
@@ -105,6 +106,7 @@ export async function resolveConfig(
105106
const [userConfig, configPath] = await resolveUserConfig(root, command, mode)
106107
const site = await resolveSiteData(root, userConfig)
107108
const srcDir = path.resolve(root, userConfig.srcDir || '.')
109+
const outDir = userConfig.outDir ? path.resolve(root, userConfig.outDir) : resolve(root, 'dist')
108110

109111
// resolve theme path
110112
const userThemeDir = resolve(root, 'theme')
@@ -132,7 +134,7 @@ export async function resolveConfig(
132134
themeDir,
133135
pages,
134136
configPath,
135-
outDir: resolve(root, 'dist'),
137+
outDir,
136138
tempDir: resolve(root, '.tmp'),
137139
markdown: userConfig.markdown,
138140
alias: resolveAliases(themeDir),

0 commit comments

Comments
 (0)