Getting Started

COMPATIBILITY NOTE

VuePress requires Node.js >= 8.

Global Installation

If you only want to play around with VuePress, you can install it globally:

  1. # install globally
  2. yarn global add vuepress # OR npm install -g vuepress
  3. # create the project folder
  4. mkdir vuepress-starter && cd vuepress-starter
  5. # create a markdown file
  6. echo '# Hello VuePress' > README.md
  7. # start writing
  8. vuepress dev
  9. # build
  10. vuepress build

Inside an Existing Project

If you have an existing project and would like to keep documentation inside the project, you should install VuePress as a local dependency. This setup also allows you to use CI or services like NetlifyGetting Started - 图1 for automatic deployment on push.

  1. # install as a local dependency
  2. yarn add -D vuepress # OR npm install -D vuepress
  3. # create a docs directory
  4. mkdir docs
  5. # create a markdown file
  6. echo '# Hello VuePress' > docs/README.md

WARNING

We currently recommend using YarnGetting Started - 图2 instead of npm when installing VuePress into an existing project that has webpack 3.x as a dependency, because npm fails to generate the correct dependency tree in this case.

Then, add some scripts to package.json:

  1. {
  2. "scripts": {
  3. "docs:dev": "vuepress dev docs",
  4. "docs:build": "vuepress build docs"
  5. }
  6. }

You can now start writing with:

  1. yarn docs:dev # OR npm run docs:dev

To generate static assets, run:

  1. yarn docs:build # OR npm run docs:build

By default, the built files will be in .vuepress/dist, which can be configured via the dest field in .vuepress/config.js. The built files can be deployed to any static file server. See Deployment Guide for guides on deploying to popular services.