mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
Changes to steps for publishing GitHub User Page (#6095)
* Changes to steps for publishing GitHub User Page Remove the the step for switching to gh-pages branch as it is no longer a viable option. * Changed projects to project
This commit is contained in:
@@ -106,7 +106,8 @@ To override this, specify the `homepage` in your `package.json`, for example:
|
||||
This will let Create React App correctly infer the root path to use in the generated HTML file.
|
||||
|
||||
**Note**: If you are using `react-router@^4`, you can root `<Link>`s using the `basename` prop on any `<Router>`.<br>
|
||||
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>
|
||||
More information [here](https://reacttraining.com/react-router/web/api/BrowserRouter/basename-string).<br>
|
||||
|
||||
<br>
|
||||
For example:
|
||||
|
||||
@@ -240,7 +241,8 @@ For more information see [Firebase Hosting](https://firebase.google.com/docs/hos
|
||||
|
||||
### Step 1: Add `homepage` to `package.json`
|
||||
|
||||
|
||||
**The step below is important!**<br>
|
||||
|
||||
**If you skip it, your app will not deploy correctly.**
|
||||
|
||||
Open your `package.json` and add a `homepage` field for your project:
|
||||
@@ -291,11 +293,10 @@ Add the following scripts in your `package.json`:
|
||||
|
||||
The `predeploy` script will run automatically before `deploy` is run.
|
||||
|
||||
The `predeploy` script will run automatically before `deploy` is run.
|
||||
|
||||
If you are deploying to a GitHub user page instead of a project page you'll need to make one
|
||||
additional modification:
|
||||
|
||||
additional modifications:
|
||||
|
||||
1. Tweak your `package.json` scripts to push deployments to **master**:
|
||||
|
||||
```diff
|
||||
"scripts": {
|
||||
@@ -312,7 +313,7 @@ Then run:
|
||||
npm run deploy
|
||||
```
|
||||
|
||||
```
|
||||
### Step 4: For a project page, ensure your project’s settings use `gh-pages`
|
||||
|
||||
Finally, make sure **GitHub Pages** option in your GitHub project settings is set to use the `gh-pages` branch:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user