JSPM

react-html-stringifier

0.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q35138F
  • License MIT

Easy way to yield a plain-html web page without any JS from your React website

Package Exports

  • react-html-stringifier

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-html-stringifier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

React Stringifier

This package is designed for:

  1. extremely lightweight single page static websites ("landing pages")
  2. based on create-react-app (without eject)

It produces a html-file without a React js-bundle.

3 simple steps

  1. Install the package: npm i -D react-html-stringifier or yarn add -D react-html-stringifier
  2. Add this line to a scripts section of the package.json: "static": "build && react-html-stringifier"
  3. Run: npm run static or yarn static

Explanation

  1. Stringifier will copy the content of your build directory to a new one called static to work with it.
  2. Then it injects a content of browser-script.js into your index.html file and starts an express server.
  3. It serves a website and receives its HTML via POST request from browser-script.js.
  4. Then HTML is received the server removes a React bundle and a browser-script.js script from it.