vuepress打包部署踩坑之路

官网教程

  • 官网给了多种部署方案,这里我才用的是部署到github上
  • 在你的项目中,创建一个如下的 deploy.sh 文件(请自行判断去掉高亮行的注释):
#!/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 -
  • 然后需要注意的是 .vuepress/config.js文件的base需要修改一下
  base: '/vue-common-vuepress/',
  • 然后运行npm run deploy就可以正常打包到github托管中了

猜你喜欢

转载自blog.csdn.net/weixin_43794749/article/details/120950702
今日推荐