0
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 1 year has passed since last update.

React で作成した App を 4Step で GitHub Pages に公開

Posted at

gh-pages ライブラリをinstall

GitHub Pages 用にbranchを作ってdeployしてくれるライブラリです.
開発環境用にインストールします.

npm install gh-pages --save-dev

save-devに関してはこちら

package.json の設定

package.jsonにデプロイコマンドとホームページを登録してやります.

package.json
{
...
  "scripts": {
    ...
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"
  },
  "homepage": "https://[github_id].github.io/[repository_name]"
...
}

デプロイ

デプロイコマンドを打ちます.

npm run deploy

Published が表示されたら成功.

公開ブランチの設定

Github 上で設定します.

Setting -> Pages -> Branch にて,
branch を gh-pages に変更します.

image.png

暫く待つとページ上部にリンクが表示されますので,
Visit Site をクリックして内容を確認

無事表示されたら終了.

0
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
0
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?