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

Conversation

Waleed-KH
Copy link

@Waleed-KH Waleed-KH commented Dec 5, 2023

Together with #3290 I want to achieve project structure like the following:

.
├─ docs                    # project root
│  ├─ src
│  │  └─ theme
│  │     └─ index.js       # theme entry
│  ├─ vitepress.config.ts  # config file
│  └─ index.md
└─ package.json

The main motivation: working with private folder (.vitepress) cause a-lot of issues with TypeScript and eslint (like motioned in #1047), even when you get the typechecker and the linter to work with .vitepress, the code editor (VSCode) fails to evaluate the the files correctly.

Also, the above structure is more familiar to Vite, I hope it would be the default for VitePress

@zhangyx1998
Copy link
Contributor

zhangyx1998 commented Jan 3, 2024

Would it be better to include this as a command line argument? e.g. npx vitepress dev docs --entry docs/src

In this way you can even specify a directory outside docs: npx vitepress dev docs --entry src

@Waleed-KH
Copy link
Author

@zhangyx1998 for --entry I think you mean to configure the srcDir option, which is already possible to specify a directory outside docs:

export default defineConfig({
  srcDir: '../'
});

In this PR my target is to be able to configure the theme entry file, which is not currently configurable and is always resolved from .vitepress/theme

@zhangyx1998
Copy link
Contributor

zhangyx1998 commented Jan 4, 2024

Not really. I meant the alternative path to .vitepress. That's where vitepress should look for user provided config.mjs, as well as the theme directory you mentioned.

This option is impossible to live inside user config because it tells vitepress from where it should load user config.

Currently vitepress always assumes user config entry to be [docRoot]/.vitepress/config.(js|mjs|cjs). It's hard coded here and here

Providing an option to override it seems like a once-and-for-all solution.

@zhangyx1998
Copy link
Contributor

It's just some random thought, please feel free to discard it.

@Waleed-KH
Copy link
Author

That might be a good option, there are already option to configure the outDir and cacheDir which uses .vitepress by default, only the theme dir and the config file path are not configurable, I've created another PR to specify the config file location, but it's been a month with no response from the maintainers.

@github-actions github-actions bot added the stale label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants