1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vue-cliでプロジェクトを作ってgithubページで公開する

Last updated at Posted at 2018-09-04

手順

vue-cliをインストールする(初回のみ)

$ npm install -g vue-cli

プロジェクト名を変数に設定

PJNAME=vuetes

プロジェクトを作成する

質問は全てENTERでOK

$ vue init webpack ${PJNAME}
$ cd ${PJNAME}

jsやcssを相対パスで取得するように変更

build内のassetsPublicPathを修正する

config/index.js
build: {
  :
  assetsPublicPath: '/',
  :

config/index.js
build: {
  :
  assetsPublicPath: '',
  :

github pagesへのデプロイを簡単にするプラグインを追加

$ npm install gh-pages --save-dev

package.jsonを修正

scriptsにdeployを追加する

package.json
"scripts": {
    "deploy": "gh-pages -d dist",
    :
}

コミットする

$ git init
$ git add -A
$ git commit -m "commit"

githubでリポジトリを作ってpushする

$ REPO=$(basename $PWD);
$ GHUSER=$(git config --get user.name);
$ GHPASS=githubパスワードを入力
$ curl -u $GHUSER:$GHPASS https://api.github.com/user/repos -d '{"name":"'$REPO'"}' --fail;
$ git remote add origin git@github.com:$GHUSER/$REPO.git;
$ git push origin master

github pagesにデプロイする

$ npm run build
$ npm run deploy

動作確認

$ open https://yfujii01.github.io/${PJNAME}/

↓これが出たら成功

image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?