How to quickly deploy a React / Redux app as a sample?
One way seems to be to deploy a React app to Heroku, but is there an easy way to deploy to our own website or the GitHub page feature so you can see the page from GitHub? (as a sample, not for production)
More details:
It seems like one possible way might be to use
wget -r --no-parent http://localhost:8080 -P sample -nH
cp -rf images any_needed_folder sample
and now you can git add sample
and git commit
and then push github and enable the GitHub page for your repo and be able to see your React app inside sample
.
You also need to change the paths to index.html
, from /bundle.js
to bundle.js
, etc., because you need a relative path instead of going to the root of your site.
(I used wget
to recursively load index.html
, bundle.js
and style/
(CSS files) because it bundle.js
cannot be found in the entire folder on the local hard drive. I used wget
because it curl
cannot seem to be recursively loaded)
source to share
If wget does what you want cool, use that.
For the actual deployment, I recommend using gh-pages for npm . It handles the creation of the orphan branch and copies the output files into it and then pushes everything to one command.
Install it:
npm install --save-dev
And in the npm script:
gh-pages -d sample
source to share