From 5b04bb9eb5ced720414f4b0d729fde36432dd451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryan=20M=C3=BCller?= Date: Wed, 5 Jan 2022 21:41:26 -0600 Subject: [PATCH] feat: user configurable `outDir` (#448) --- .gitignore | 3 ++- docs/guide/deploy.md | 2 +- src/node/config.ts | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0e9bd5c8..f71faa25 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist node_modules TODOs.md -.vscode \ No newline at end of file +.vscode +.idea diff --git a/docs/guide/deploy.md b/docs/guide/deploy.md index 4221893c..9c884e5f 100644 --- a/docs/guide/deploy.md +++ b/docs/guide/deploy.md @@ -136,7 +136,7 @@ deploy: If you are deploying to `https://.gitlab.io//`, for example your repository is at `https://gitlab.com//`, then set `base` to `'//'`. -2. Set `dest` in `.vitepress/config.js` to `public`. +2. Set `outDir` in `.vitepress/config.js` to `../public`. 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: diff --git a/src/node/config.ts b/src/node/config.ts index dc30312d..3080395d 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -38,7 +38,7 @@ export interface UserConfig { locales?: Record markdown?: MarkdownOptions /** - * Opitons to pass on to `@vitejs/plugin-vue` + * Options to pass on to `@vitejs/plugin-vue` */ vue?: VuePluginOptions /** @@ -48,6 +48,7 @@ export interface UserConfig { srcDir?: string srcExclude?: string[] + outDir?: string shouldPreload?: (link: string, page: string) => boolean /** @@ -105,6 +106,7 @@ export async function resolveConfig( const [userConfig, configPath] = await resolveUserConfig(root, command, mode) const site = await resolveSiteData(root, userConfig) const srcDir = path.resolve(root, userConfig.srcDir || '.') + const outDir = userConfig.outDir ? path.resolve(root, userConfig.outDir) : resolve(root, 'dist') // resolve theme path const userThemeDir = resolve(root, 'theme') @@ -132,7 +134,7 @@ export async function resolveConfig( themeDir, pages, configPath, - outDir: resolve(root, 'dist'), + outDir, tempDir: resolve(root, '.tmp'), markdown: userConfig.markdown, alias: resolveAliases(themeDir),