Vuepress packaging and deployment stepping on the road

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>
/**这个地方换成自己的github地址和仓库地址**/
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

Guess you like

Origin blog.csdn.net/weixin_43794749/article/details/120950702