# 1. 空项目

# 1.1. vuepress init(yarn version)

因为npm会出错(比如win上失败了),而yarn则成功了

$ mkdir project && cd project

$ yarn init

# 将 VuePress 安装为本地依赖
$ yarn add -D vuepress

# 添加运行命令
$ vim package.json
"scripts": {
    "vuepress:dev": "vuepress dev docs",
    "vuepress:build": "vuepress build docs"
}

# 文档放置的地方
$ mkdir docs

# 一篇文档
$ echo '# Hello VuePress' > docs/README.md

# VuePress 站点的基本配置文件的文件夹
$ mkdir -p docs/.vuepress
# VuePress 站点的基本配置文件
$ vim docs/.vuepress/config.ts
import { defineConfig } from "vuepress/config";
export default defineConfig({
  title: 'Hello VuePress',
  base: '/vuepress-starter/',
});

$ yarn vuepress:dev

VuePress 会在 http://localhost:8080 (opens new window) (opens new window)启动一个热重载的开发服务器。

project
├── docs
│   ├── .vuepress
│   │   └── config.ts
│   └── README.md 
├── node_modules
├── package.json
└── yarn.lock