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

Allow using config folder other than .vitepress #2909

Open
4 tasks done
Pandapip1 opened this issue Sep 5, 2023 · 2 comments
Open
4 tasks done

Allow using config folder other than .vitepress #2909

Pandapip1 opened this issue Sep 5, 2023 · 2 comments
Labels
has-workaround Has workaround, low priority stale

Comments

@Pandapip1
Copy link

Is your feature request related to a problem? Please describe.

The naming .vitepress seems to imply some sort of configuration. However, in some instances, the configuration is a major enough part of the project that it deserves to be in a subfolder of the src directory. Basically, instead of .vitepress and src, I would like to be able to use src/vitepress and src/website.

Describe the solution you'd like

I'm not entirely sure how vitepress could determine the path. Maybe a vitepress build CLI option?

Describe alternatives you've considered

No response

Additional context

No response

Validations

@brc-dd brc-dd added the has-workaround Has workaround, low priority label Sep 6, 2023
@github-actions github-actions bot added the stale label Oct 8, 2023
@maxpatiiuk
Copy link

HI, @brc-dd. This issue was labeled as has-workaround, but I do not see what workaround is available. Could you please clarify?


It appears that VitePress is hardcoded to look for the .vitepress directory, with no CLI option to customize that:

const resolve = (root: string, file: string) =>
normalizePath(path.resolve(root, `.vitepress`, file))

I wish to customize the directory name because TypeScript is hardcoded to ignore directories that start with ., even if explicitly included in tsconfig.json. That means files in the .vitepress directory are not covered by our TypeScript config.

Worse still, typescript-eslint throws an error if you try to lint a file that is not covered by TypeScript, so we are forced to also disabled ESLint for .vitepress directory.

@brc-dd
Copy link
Member

brc-dd commented Dec 20, 2024

The workaround was basically you can store the files wherever you want. Just reexport default from config/theme.

And regarding ts, you can definitely include files in directories starting with dot, it just won't expand them in **. So you need to write docs/.vitepress/**/*.ts or something (but even then you should use it in composite mode with separate tsconfig for config and theme/vue/md, your aliases and stuff won't take effect inside config files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround Has workaround, low priority stale
Projects
None yet
Development

No branches or pull requests

3 participants