This is the source codes for web pages https://miaxia.github.io/mcx/.
This project was bootstrapped with Create React App.
Dev branch is used for development, and the published static files are in gh-pages branch
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Deploy this app on github pages https://miaxia.github.io/mcx/
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
Note: this is a one-way operation. Once you eject
, you can’t go back!
If you aren’t satisfied with the build tool and configuration choices, you can eject
at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject
will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use eject
. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
I created a react app at my local, then I tried to upload it onto git repository and deploy it with github pages.
Create a new repository, note that avoid the format of username/github.io
as repository name. Because it will mark this repo as personal pages and the defalut publish branch must be master and you cannot change it.
You don't need readme and gitignore file, click create repository
and you will have the new repo.
I assume that you have a existed react app at local, then you can use terminal to upload this react app onto the repo you just created.
cd Desktop/personalBlogReactApp //go to the react app folder
git init //init git
//sometimes it will ask you gihub account and password if you didn't set up, follow the instruction and sign in
git add . //add all files
git commit -m "first commit" //commit to local
git remote add origin https://github.com/MiaXIA/personalBlog.git //the repository address of project
git push -u origin master //push all the files to remote branch
Then refresh the github page you can see all the codes are there.
You need to install a package called gh-pages
npm install --save gh-pages
Then you need to edit the package.json file in your react app, add the homepage and some deploy scripts.
"homepage":"https://yourusername.github.io/repository-name"
//Here my homepage address will be https://miaxia.github.io/mcx/
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
}
You are almost done! In your terminal, you need one more line:
npm run deploy
After created the new repo and uploaded the react app. Goto the settings on the repo's main page, scroll down and find the GitHub Pages
title.
Once you successfully deployed, then one last thing you need to do is change the Source
of Github Pages
to gh-pages branch
Also you can see the notification Your site is publish at xxx
once you change the source branch.
Enjoy your new react app personal blog!