vuepress
https://vuepress.docschina.org/
全局安装VuePress
npm install -g vuepress
#or
yarn global add vuepress
初始化项目
mkdir vuepress-project
cd vuepress-project
yarn init -y # npm init -y
# 安装为本地依赖项
yarn add -D vuepress # 或 npm install -D vuepress
# 创建一个 docs 目录
mkdir docs
# 创建一个 markdown 文件
echo '# Hello VuePress' > docs/README.md
修改package.json
{
"name": "vuepress-project",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"vuepress": "^1.0.2"
},
"scripts": {
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
}
}
部署到github
# 生成静态文件
yarn docs:build
# 进入生成的文件夹
cd docs/.vuepress/dist
git init
git add -A
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
# 如果发布到 https://<USERNAME>.github.io/<REPO>
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages