27
14

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 Pagesにデプロイ

Last updated at Posted at 2018-10-30

1. いつもどおり vueのプロジェクトをつくる

$ vue init webpack <projectname>

2. config/index.js 内の buildメソッドを編集する

  • dist/ を docs/ に変える (2箇所)
  • assetsPublicPath を / から ./ に変える

  build: {
    // Template for index.html
-    index: path.resolve(__dirname, '../dist/index.html'),
+    index: path.resolve(__dirname, '../docs/index.html'),

    // Paths
-    assetsRoot: path.resolve(__dirname, '../dist'),
+    assetsRoot: path.resolve(__dirname, '../docs'),
    assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
+    assetsPublicPath: './',

3. ビルドする

$ mkdir docs
$ npm run build

4. ふつうにGithubにデプロイ

$ git add -A
$ git commit -m "<commit-message>"
$ git push origin master

5. Github側でデプロイ設定する

settingsタブの中に Github Pagesの項目がある。

スクリーンショット 2018-10-30 20.04.29.png

Sourceを master branch /docs folder にする。

スクリーンショット 2018-10-30 20.03.08.png

6. 確認

https://あなたのGithub垢.github.io/レポジトリの名前/ をチェック。

例えばこんなURL: https://msrks.github.io/boardgame-manager/

27
14
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
27
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?