Official website tutorial
- The official website gives a variety of deployment options, here I use the deployment to github
- In your project, create a deploy.sh file as follows (uncomment the highlighted lines at your own discretion):
#!/usr/bin/env sh
# 确保脚本抛出遇到的错误
set -e
# 生成静态文件
npm run docs:build
# 进入生成的文件夹
cd docs/.vuepress/dist
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git add -A
git commit -m 'deploy'
# 如果发布到 https://<USERNAME>.github.io
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git main
# 如果发布到 https://<USERNAME>.github.io/<REPO>
git push -f git@github.com:FightingN/vue-common-vuepress.git master:gh-pages
cd -
- Then it should be noted that the base of the .vuepress/config.js file needs to be modified
base: '/vue-common-vuepress/',
- Then run npm run deploy to package it normally into github hosting