yarn 配置步骤
- 创建并进入一个新目录
mkdir vuepress-starter && cd vuepress-starter
- 使用你喜欢的包管理器进行初始化
yarn init
- 将 VuePress 安装为本地依赖
yarn config set ignore-engines true #忽略错误
yarn add -D vuepress
- 创建你的第一篇文档,VuePress 会以 docs 为文档根目录,所以这个 README.md 相当于主页:
mkdir docs && echo '# Hello VuePress' > docs/README.md
- 在 package.json 中添加一些 scripts’
{
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
}
}
- 启动本地服务器
yarn docs:dev # npm run docs:dev
VuePress 会在 http://localhost:8080 (opens new window) 启动一个热重载的开发服务器。
- push到GitHub
# 本地build
yarn docs:build # npm run docs:build
# 进入生成的文件夹, 进行push操作
cd docs/.vuepress/dist