React GitHub Pages Boilerplate uses React, GH-Pages, Vite, Tailwind, DaisyUI, Animate.css.
In addition to providing a boilerplate, this template also solves 404 error when refreshing a React app deployed to GitHub Pages. That too without using Hash Router.
Additionally, you can get rid of any libraries that are installed and replace them with preferred.
Clone the repo and install dependencies:
git clone --depth 1 --branch main https://github.com/hanzlamateen/react-gh-pages-boilerplate.git your-project-name
cd your-project-name
npm install
Start the app in the dev
environment:
npm run dev
To create a production build in dist
folder:
npm run build
Start the dev server and test production build:
npm run preview
- Go to Settings β Actions β General.
- Scroll down to Workflow permissions.
- Choose Read and write permissions and hit Save.
- Go to Settings β Secrets and variables β Actions.
- Click New Repository Secret.
- Add Name as
GH_PAGE_DEPLOY
and Secret as `true. Hit Add Secret.
Actions β choose last deployment β Re-run all jobs. Wait until in finishes.
- Go to Settings β Pages.
- Under Source, choose "Deploy from a branch" and select the "gh-pages" branch.
- Click Save.
Once the workflow finishes successfully, you'll see a new deployment on your GitHub Pages. Click the link to access your deployed React application.
Support us with a monthly donation and help us continue our activities.
MIT Β© Hanzla Mateen