Skip to content

Instantly share code, notes, and snippets.

@btorresgil
Last active November 1, 2022 13:19
Show Gist options
  • Save btorresgil/2765d146c66c873df8a1cea31864efec to your computer and use it in GitHub Desktop.
Save btorresgil/2765d146c66c873df8a1cea31864efec to your computer and use it in GitHub Desktop.
Deploy to gh-pages
  1. Add homepage to package.json
{
  "homepage": "https://user.github.io/repo"
}
  1. Install gh-pages npm package
$ npm install -D gh-pages
  1. For a custom domain, add a CNAME file to public/CNAME (more info)
$ echo 'mydomain.com' > public/CNAME
  1. Add a deploy script to package.json
"scripts": {
  //...
  "predeploy": "npm run build",
  "deploy": "gh-pages -d build"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment