This package is designed for:
- extremely lightweight single page static websites ("landing pages")
- based on create-react-app (without eject)
It produces a html-file without a React js-bundle.
3 simple steps
- Install the package:
npm i -D react-html-stringifieror
yarn add -D react-html-stringifier
- Add this line to a
scriptssection of the
"static": "react-scripts build && react-html-stringifier"
npm run staticor
- Stringifier will copy the content of your
builddirectory to a new one called
staticto work with it.
- Then it injects a content of
index.htmlfile and starts an
- It serves a website and receives its HTML via POST request from
- (optional) Then HTML is received the server removes a React bundle and a
browser-script.jsscript from it.
package.json create a property
stringifier. These are defaults:
timeout is needed to ensure React is rendered. It's the time after the page loaded and before its HTML is sent to the Stringifier.
Known Problems (may be fixed later)
- It does not work on Windows (uses shell commands for copying directories).