- Create Git repo, add code, push code
- Enable GitHub pages.
- In Vue code, create new file vue.config.js with this contents. This file will be in the base directory of your project, same place as package.json. Change name-of-your-repo to the name of your GitHub repo
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/name-of-your-repo/'
: '/',
outputDir: "docs"
}
- Run
npm run build
A /docs directory will be created.
- Change into docs directory,
cd docs
- Make sure you are in the docs directory. Create new GitHub repo in the docs directory and add and commit all files with
git init
git add -A
git commit -m "deploy"
- Force push the code in the docs directory to the gh-pages branch at GitHub. Change the URL to your repository's URL.
Double-check this command before you run it, make sure you are in the docs directory, and don't miss off the master:gh-pages part!
git push -f https://github.com/your-github-account/name-of-your-repo master:gh-pages
-
In the repository settings, go to GitHub pages section. Change the branch from master to gh-pages.
Set or confirm the folder to be root. Click save. -
Wait a few minutes
-
Your site should be at this address. Note slash at the end of the URL. https://your-github-account.github.io/name-of-your-repo/
-
To make updates, repeat steps 4 through 10.