项目作者: bagus123

项目描述 :
Use vue cli to publish in github pages demo : https://bagus123.github.io/vue-gh-pages/
高级语言: Vue
项目地址: git://github.com/bagus123/vue-gh-pages.git
创建时间: 2018-11-13T11:31:39Z
项目社区:https://github.com/bagus123/vue-gh-pages

开源协议:

下载


Create Github Pages Using Vue Cli

open console, run this command :

  1. #install vue cli global
  2. npm install -g @vue/cli
  3. #create project
  4. vue create vue-gh-pages

then, select default(babel, eslint)

Yay!, your vue project created!..

next step add file deploy.bat (windows) and deploy.sh (linux & mac)

deploy.sh
  1. # file deploy.sh
  2. #!/usr/bin/env sh
  3. # abort on errors
  4. set -e
  5. # build
  6. npm run build
  7. # navigate into the build output directory
  8. cd dist
  9. # if you are deploying to a custom domain
  10. # echo 'www.example.com' > CNAME
  11. git init
  12. git add -A
  13. git commit -m 'deploy'
  14. # if you are deploying to https://<USERNAME>.github.io
  15. # git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
  16. # if you are deploying to https://<USERNAME>.github.io/<REPO>
  17. # git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
  18. cd -
deploy.bat
  1. @echo off
  2. npm run build&&cd dist&&git init&&git add -A&&git commit -m 'deploy'&&git push -f https://github.com/bagus123/vue-gh-pages.git master:gh-pages&&cd ..

ok, everything done, let’s go deploy to github pages

run in console

  1. sh deploy.sh

run in cmd (windows)

  1. deploy

then, github pages will be created, in this source created on this link :

https://bagus123.github.io/vue-gh-pages/

refences