Skip to content

Instantly share code, notes, and snippets.

@ciamac-da
Last active September 1, 2021 10:33
Show Gist options
  • Save ciamac-da/cf8fbbe5b57dd000bd6e7dc5e52cc018 to your computer and use it in GitHub Desktop.
Save ciamac-da/cf8fbbe5b57dd000bd6e7dc5e52cc018 to your computer and use it in GitHub Desktop.
This is how to deployment React projects on Github
1- Open package.json file and add a homepage at the top before name
==> "homepage": "https://<USERNAME>.github.io/<PROJECT NAME>",
2- install gh-pages using ==> npm i gh-pages
3- Add pre-deploy and deploy to scripts field in package.json file ==>
"pre-deploy": "npm run build",
"deploy": "gh-pages -d build"
4- type npm run pre-deploy in terminal
5- type npm run deploy in terminal
6- It's Done!:) click on homepage link to see published version of your project!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment