- Create a project on gitHub
- clone that gitHub project on your computer with `git clone ...`
- in your terminal, go to that project with `cd .....`
- create a vue project in that folder with `vue create .`
- install all dependencies `yarn install`
- in the `.gitignore` file comment out the folder `/dist` (we will later publish our vueJS page in that `dist` folder and push it on gitHub)
- create a new branch with `git co -b gh-pages`
- create a new file `vue.config.js` with `touch vue.config.js`
- in that file write: module.exports = { publicPath: ‘<my-project>’ }
- modify the changes you want to make
- test your changes with `yarn serve`
- if you are satisfied we can build for production with `yarn build`
- add the changes you want to push: `git add dist && git commit -m "Initial dist subtree commit`
- push only the dist folder to your gh-branch on gitHub: `git subtree push --prefix dist origin gh-pages`. This part is very important. If you push everything into gitHub, then nothing will be displayed. The trick is to only push the `dist` folder on to gitHub. In order not to lose any changes, I would commit and push everything to `master` and on the branch `gh-pages`, I'd only push the `dist` changes
- go to gitHub and then to the settings
- in the section gitHub pages you should see a link where your vueJS can be reached. Click on that and you should see the same page you see earlier with `yarn serve`
Sunday, 8 September 2019
Post 71: Publish gitHub page with VueJS + Vue cli
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment