Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to make a react project a githubpages site

1) Add GitHub Pages dependency package

Install "gh-pages" package using the below command.

npm install gh-pages — save-dev
Makefile
2) Add homepage property to package.json file

Add the below property to your package.json file.
For a GitHub user site: 
"homepage": "https://{username}.github.io"
For a custom domain: 
"homepage": "https://testwebsite.com"


3) Add deploy scripts to package.json file

Add both predeploy and deploy property scripts to the package.json file as below,

"predeploy": "npm run build",
"deploy": "gh-pages -d build"
Makefile
  The "predeploy" command is used to bundle the react application and the "deploy" command helps to deploy the bundled file.



4) Create a remote GitHub repository

Initialize the Git using "git init" command.
Add it as remote using "git remote add origin your-github-repository-url.git" command.
5) Deploy the Application to GitHub Pages

Now run the below command to deploy your react application to GitHub Pages.

npm run deploy
Comment

install github pages in react app

$ cd my-react-app
$ npm install gh-pages --save-dev
Comment

PREVIOUS NEXT
Code Example
Shell :: gradle test 
Shell :: how switching in git branches 
Shell :: django upgrade 
Shell :: debian install docker 
Shell :: sudo apt-get install jpeg 
Shell :: install adminlte 
Shell :: git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. 
Shell :: compare two files shell script 
Shell :: umask linux 
Shell :: docker command to login with user name and pass word 
Shell :: git clone with long file names 
Shell :: Pyserial is not installed for /Applications/Xcode.app/Contents/Developer/usr/bin/python3 macos 
Shell :: proxy shell 
Shell :: permissions do not allow pasting files in this directory 
Shell :: git submodule 
Shell :: curl find latency 
Shell :: how to run tar.gz file in linux 
Shell :: creating new branch in git 
Shell :: cache clear env prod symfony 3.4 
Shell :: uninstall flake 8 in vs 
Shell :: how to Add new commit to the existing Git tag 
Shell :: order allow deny 
Shell :: awk uppercase first character 
Shell :: nvme cli 
Shell :: how to run a ipynb file in cmd 
Shell :: debian pinning packages 
Shell :: create ssh key github 
Shell :: sublime path for filezilla in ubuntu 
Shell :: concatenate multiple zip files linux 
Shell :: batch file extension 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =