Original source: https://blog.logrocket.com/build-deploy-vue-js-app-github-pages/
- Follow above tutorial, probably. But TL;DR
- Integrate source folders/files with your app
- Modify scripts/gh-pages-deploy.js with your project name
- Commit & push to your
master
branch - Run
npm run deploy
to deploy to GitHub pages
GitHub doesn't support history mode in Vue.js within GitHub pages, so a workaround was to manually set this to mode: 'hash'
within my project. The impact of this was hash mode was used everywhere, including on Prod. Not ideal. My modified gh-pages-deploy.js
script finds/replaces this automatically prior to deploying to GitHub pages upon the npm run deploy
command.
Secondly, as per guide above, a vue.config.js
file is required along with setting a publicPath
matching your GitHub pages project name. The impact was this was also affecting Prod as well. So as per above, my modified script also finds/replaces for you automatically.
Don't worry, the find/replaces are also automatically reverted back upon a successful deploy 😉