1- install gh-pages as dev dep.
cd my-app
npm install gh-pages --save-dev
3- Add properties to package.json file.
The first property we need to add at the top level homepage second we will define this as a string and the value will be "http://{username}.github.io/{repo-name}" {username} is your GitHub username, and {repo-name} is the name of the GitHub repository you created it will look like this :
"homepage": "http://yuribenjamin.github.io/my-app"
Second in the existing scripts property we to need to add predeploy and deploy.
IT IS IMPORTANT TO ADD -b gh-pages.
-b is the argument to specify the branch to deploy to when runnig deploy.
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build -b gh-pages"
}
4- Now deploy it to GitHub Pages.
just run the following command :
15 - update your gihub setting -> pages -> to use the new gh-page branch
npm run deploy