Demonstration of using server-side includes to inject runtime configuration to a single-page app.
- Bootstrapped using Create React App
- Requires
html-minifier-terserof at least 5.1.0 (see this Pull Request) or explicit configuration to leave SSI comments in HTML (can be done viawebpack-html-pluginbut not in CRA) - Set up for deployment to Cloud Foundry
This demo includes two sets of configuration:
- development (in
src/configuration.js); and - production (in
public/config.html).
The SSI directive in public/index.html is replaced by the content of public/config.html at
runtime, if SSI is enabled on the server (the included Staticfile does this for the Nginx used
in the Staticfile buildpack).
To run locally with the development configuration:
npm startTo deploy to CF with the production configuration, using the CF CLI:
npm run build && cf push