react로 github page를 만드는 방법은 react-gh-pages에 자세히 나와있다.
npm install gh-pages --save-dev
"homepage": "http://devstefancho.github.io/profile",
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
git remote
를 추가한다.npm run deploy
로 배포를 한다.수정한 소스코드를 git push를 하지 않고, npm run deploy만 해줘도 되지만, 이런 경우 깃헙에 이전 소스가 캐싱되어, 페이지가 이전버전으로 보이는 듯하다. 이런 경우는 Empty cache and Hard Reload를 해줘야한다.
settings > Pages 에서 Source Branch를 gh-pages로 바꿔준다.
(만약 git push를 한다면, 자동으로 github에서 퍼지를 해주는 것 같다.)