Consider to allow to use alternative for public directory
See original GitHub issueFeature request
What problem does this feature solve?
The problem is that images and other resources which are referenced in markdown files won’t work any other environment (on GitHub, GitLab, local preview tools). Because the resources need to be placed into the .vuepress/public directory, but the URL won’t include neither .vuepress nor public.
This is really weird.
// edit Also this will be much easier for everyone who is migrating to VuePress, for instance from GitBook.
What does the proposed API look like?
Allow to put images and other resources next to the markdown files instead of forcing to put them into .vuepress/public.
How should this be implemented in your opinion?
For the vuepress build command just passthrough all files which are have not a markdown file extension. This is the only file types you’re expecting, right? Other files, like styles or vue components live somewhere else, so they are not affected.
Are you willing to work on this yourself?
Sure, let me know if you agree in general with this idea.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:8 (2 by maintainers)

Top Related StackOverflow Question
I’m not trying to be ungrateful (I can’t complain about free stuff), but I’ve waited for this way too long now and can’t wait anymore. Instead, I’ve come up with my own solution, which simply looks for all files in the
srcfolder (recursively) that does not have the file extension.mdand copies them to the same place in thesrc/.vuepress/publicfolder when the development server starts (e.g.src/sub-folder/hello.txtis copied tosrc/.vuepress/public/sub-folder/hello.txt).Here’s the function that does it (add it too
src/.vuepress/config.jsand call it there):This works great for me, so I share this piece of code if anyone else is in the same situation as me and in need of a quick fix. Remember that the files are only copied when the development server starts, so adding/changing static files after that requires a restart.
@timaschew @rreinhardt I have drafted a PR for this.
#1494