From 1c5a5f9b9deff56ea7770060b02b918d9a375a79 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen <info@mathias-biilmann.net> Date: Sat, 6 Aug 2016 13:22:49 -0700 Subject: [PATCH 1/3] Add Netlify to deploy instructions --- template/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/template/README.md b/template/README.md index 65984ecaf..bc57eff05 100644 --- a/template/README.md +++ b/template/README.md @@ -22,6 +22,7 @@ You can find the most recent version of this guide [here](https://github.com/fac - [Integrating with a Node Backend](#integrating-with-a-node-backend) - [Proxying API Requests in Development](#proxying-api-requests-in-development) - [Deployment](#deployment) + - [Netlify](#netlify) - [Now](#now) - [Heroku](#heroku) - [GitHub Pages](#github-pages) @@ -511,6 +512,39 @@ 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. +## Netlify + +**To do a manual deploy to Netlify's CDN:** + +```sh +npm install netlify-cli +netlify deploy +``` + +Choose `build` as the path to deploy. + +**To setup continuous delivery** + +With this setup Netlify will build and deploy when you push to git or open a pull request: + +1. [Start a new netlify project](https://app.netlify.com/signup) +2. Pick your Git hosting provider and select your create-react-app project +3. Set the `Dir` to `build` and `Build command` to `npm build` + +**Support for client site routing:** + +To support `pushState` add a `src/_redirects` file with the following rewrite rule: + +``` +/* /index.html 200 +``` + +Then add this import statement to `src/index.js`: + +```js +import "file?name=_redirects!./_redirects"; +``` + ### Now See [this example](https://github.com/xkawi/create-react-app-now) for a zero-configuration single-command deployment with [now](https://zeit.co/now). -- GitLab From 1817ffc478a01885e6d5c82fd111fdb3f61e2114 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen <info@mathias-biilmann.net> Date: Sat, 6 Aug 2016 13:47:18 -0700 Subject: [PATCH 2/3] Simplify continuous delivery instructions Netlify now autodetects create-react-app projects and sets the right build command and folder settings automatically. --- template/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/README.md b/template/README.md index bc57eff05..cf8b1cdfe 100644 --- a/template/README.md +++ b/template/README.md @@ -528,8 +528,8 @@ Choose `build` as the path to deploy. With this setup Netlify will build and deploy when you push to git or open a pull request: 1. [Start a new netlify project](https://app.netlify.com/signup) -2. Pick your Git hosting provider and select your create-react-app project -3. Set the `Dir` to `build` and `Build command` to `npm build` +2. Pick your Git hosting service and select your create-react-app repository +3. Click `Build your site` **Support for client site routing:** -- GitLab From 27c483d1f764baac481a4832f7a9961aaba4bd77 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen <info@mathias-biilmann.net> Date: Tue, 9 Aug 2016 13:07:02 -0700 Subject: [PATCH 3/3] Get rid of webpack specific instructions to add _redirects file --- template/README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/template/README.md b/template/README.md index cf8b1cdfe..ec0b78505 100644 --- a/template/README.md +++ b/template/README.md @@ -533,18 +533,12 @@ With this setup Netlify will build and deploy when you push to git or open a pul **Support for client site routing:** -To support `pushState` add a `src/_redirects` file with the following rewrite rule: +To support `pushState`, make sure to create a `build/_redirects` file with the following rewrite rules: ``` /* /index.html 200 ``` -Then add this import statement to `src/index.js`: - -```js -import "file?name=_redirects!./_redirects"; -``` - ### Now See [this example](https://github.com/xkawi/create-react-app-now) for a zero-configuration single-command deployment with [now](https://zeit.co/now). -- GitLab