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

How to configure the build directory of vitepress ? #171

Closed
soulsam480 opened this issue Dec 1, 2020 · 9 comments · Fixed by #448
Closed

How to configure the build directory of vitepress ? #171

soulsam480 opened this issue Dec 1, 2020 · 9 comments · Fixed by #448

Comments

@soulsam480
Copy link
Contributor

No description provided.

@harlan-zw
Copy link
Contributor

harlan-zw commented Dec 3, 2020

Are you talking about the dist folder? You can't at the moment.

It's hardcoded @ src/node/config.ts:59

@soulsam480
Copy link
Contributor Author

Sure

@Jaimeloeuf
Copy link

Hi @harlan-zw just curious if there is a reason why this is not supported in vitepress unlike vuepress? Does not necessarily seems like a difficult thing to do unless I missed something?

Having this config would be great where a vitepress site's source files and build output can be in the same github repo and use github pages for hosting, unlike the solution in the docs which requires another repo just for the output.

If this is something that is reasonable, let me know and perhaps I can submit a PR? Thanks!

@harlan-zw
Copy link
Contributor

Hey @Jaimeloeuf, this is a pretty outdated issue and I haven't touched vitepress too much since it was raised.

Having a quick glance at the code though, it seems like there is now a outDir option that should let you control it, but I'm not too sure.

https://github.com/vuejs/vitepress/blob/main/src/node/config.ts#L69

@Jaimeloeuf
Copy link

Hey @harlan-zw thanks alot for getting back to me on this old issue!

Looking through the code, although there is a outDir prop on the SiteConfig interface since quite a few commits back, it looks to be always hard coded to be 'dist' and nothing else.

outDir: resolve(root, 'dist'),


Also the other thing I noticed is that this prop is on the SiteConfig interface, and not the UserConfig interface here which from what I understand looking at the code, the UserConfig is designed to override some SiteConfig props but just that the outDir prop in particular is left out.

Since the resolveConfig function always return the hardcoded outDir, there is currently no way to override it other than manually editing the config.ts file or maintaining a fork which I would like to avoid. Do you think that this feature is something that can be added? And if so, I would be able to help out with a PR.

Let me know, thanks a lot!

@harlan-zw
Copy link
Contributor

Nice investigating @Jaimeloeuf

I know that VitePress aims to be simple and opinionated in how it's built, saying that it seems like a useful feature and can't imagine it would be that much work. I don't have much control over what will and won't get merged but submitting a PR seems like a good idea if you have some time to work on it.

Mando75 added a commit to Mando75/vitepress that referenced this issue Nov 20, 2021
For reference, see vuejs#171. outDir existed on SiteConfig but not UserConfig.

Updates UserConfig to accept an optional outDir and resolve it the same way vitepress resolves srcDir. The original .vitepress/dist behavior is provided as fallback if no user-provided outDir is present.
@Mando75
Copy link
Contributor

Mando75 commented Nov 20, 2021

Hi, I have opened a PR to add this option to the UserConfig. Please see #448 and leave any feedback you have. Hopefully the maintainers see the value and decide to add it.
Didn't mean to snipe this if someone else was working on a PR, but I would very much like this feature and I didn't see it already being worked on.

@Jaimeloeuf
Copy link

Hey @Mando75 thanks alot for the help! Got abit busy and appreciate it, hope this gets merged soon :)

@Mando75
Copy link
Contributor

Mando75 commented Jan 6, 2022

FYI, my PR was merged in release v0.21.3, so you can now set the output directory by using the outDir parameter in your vite config.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants