티스토리 뷰

반응형

www.npmjs.com/package/gh-pages

 

gh-pages

Publish to a gh-pages branch on GitHub (or any other branch on any other remote)

www.npmjs.com

Create-react-app

 

1. 설치

$ npm i gh-pages

 

2. package.json에 속성 추가

{
  	// ...생략...
    
	"scripts": {
		"start": "react-scripts start",
		"build": "react-scripts build",
		"deploy": "gh-pages -d build",
		"predeploy": "npm run build"
	},

  	// ...중략...

	"homepage": "https://{깃헙아이디}.github.io/{Repository이름}"
}

predeploy는 npm run deploy 명령어 하나로 gh-pages를 하기 전에 build를 해야하는 작업을 자동으로 해준다.

 

3. 빌드하여 build 폴더를 생성 

$ npm run build

아래와 같이 build가 생성 됨

 

4. DEPLOY!

$ npm run deploy

 

https://{깃헙아이디}.github.io/{Repository이름}

에서 확인해보자

 

 

 

 

 

 

 

 

 

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함