Thomas Rutzer
Thomas Rutzer

Reputation: 53

Store .vuepress folder in another directory

Is there a way to configure vuepress to look for the folder .vuepress somewhere else than default /docs?

Upvotes: 4

Views: 1277

Answers (2)

tony19
tony19

Reputation: 138276

UPDATE: VuePress 1.5.0 now only reads from docs/.vuepress, so the workaround below no longer works. However, another possible (less elegant) workaround is to symlink the docs/.vuepress to the desired location (tested on macOS Catalina).

For example, you could symlink it to <projectRoot>/.vuepress on macOS with:

mkdir .vuepress docs
cd docs
ln -s ../.vuepress

As of VuePress 0.12.0, there's no specific configuration to set the location of .vuepress/. VuePress always looks for .vuepress/ in the target directory (docs/) and the immediate parent directory. If not found, VuePress creates .vuepress/ in the parent directory of docs/.

If your objective is to prevent the creation of docs/.vuepress/ and you didn't mind .vuepress/ in the parent directory of docs/:

  1. Create .vuepress/config.js in the parent directory of docs/.
  2. Edit that file to contain the following config:

    module.exports = {
      dest: 'foo' // desired path to VuePress output
    }
    
  3. Run vuepress build in the parent directory of docs/.

The result of the above config is to create a directory foo/ with the VuePress static site output:

$ vuepress build

WAIT  Extracting site metadata...
[2:20:45 AM] Compiling Client
[2:20:45 AM] Compiling Server
(node:47073) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[2:20:48 AM] Compiled Server in 3s
[2:20:50 AM] Compiled Client in 5s
WAIT  Rendering static HTML...

DONE  Success! Generated static files in foo.

Upvotes: 0

akauppi
akauppi

Reputation: 18046

Don't think there is. In 2018, the author has stated:

I don't see practical value in this except for personal preference, so probably not.

Upvotes: 0

Related Questions