logo
努力加载中 ……

Getting Started

原创meteorlxy, shentuzhigang, bleatingsheep, shentuzhigang10/14/2022, 9:34:23 AM361a minute

Getting Started

Prerequisites

TIP

Manual Installation

This section will help you build a basic VuePress documentation site from ground up. If you already have an existing project and would like to keep documentation inside the project, start from Step 3.

  • Step 1: Create and change into a new directory
mkdir vuepress-starter
cd vuepress-starter
  • Step 2: Initialize your project
git init
yarn init
git init
npm init
  • Step 3: Install VuePress locally
yarn add -D vuepress@next
npm install -D vuepress@next
  • Step 4: Install VuePress Theme Star
yarn add -D vuepress-theme-star
npm install -D vuepress-theme-star
  • Step 5: Config Theme

Create docs/.vuepress/config.js or docs/.vuepress/config.ts

module.exports = {
  theme: '@starzkg/star',
}
{
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }
}
  • Step 7: Add the default temp and cache directory to .gitignore file
echo 'node_modules' >> .gitignore
echo '.temp' >> .gitignore
echo '.cache' >> .gitignore
  • Step 8: Create your first document
mkdir docs
echo '# Hello VuePress' > docs/README.md
  • Step 9: Serve the documentation site in the local server
yarn docs:dev
npm run docs:dev

VuePress will start a hot-reloading development server at http://localhost:8080open in new window. When you modify your markdown files, the content in the browser will be auto updated.

By now, you should have a basic but functional VuePress documentation site. Next, learn about the basics of configuration in VuePress.