From 1687c5a8fbfea56e4a083e78758d56937ecd6873 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 3 Sep 2021 15:33:32 -0500 Subject: [PATCH] Docs: document build variables --- docs/development/build-config.md | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/development/build-config.md diff --git a/docs/development/build-config.md b/docs/development/build-config.md new file mode 100644 index 000000000..a1e331e38 --- /dev/null +++ b/docs/development/build-config.md @@ -0,0 +1,49 @@ +# Build Configuration + +When compiling Soapbox FE, environment variables may be passed to change the build itself. +For example: + +```sh +NODE_ENV="production" FE_BUILD_DIR="public" FE_BASE_PATH="/soapbox" yarn build +``` + +The following build variables are available: + +### `NODE_ENV` + +The environment to build Soapbox FE for. + +Options: +- `"production"` - For live sites +- `"development"` - For local development +- `"test"` - Bootstraps test environment + +Default: `"development"` + +It's recommended to always build in `"production"` mode for live sites. + +### `FE_BUILD_DIR` + +The folder to put build files in. This is mostly useful for CI tasks like GitLab Pages. + +Options: +- Any directory name, eg `"public"` + +Default: `"static"` + +### `FE_BASE_PATH` + +Subdirectory to host Soapbox FE out of. +When hosting on a subdirectory, you must create a custom build for it. +This option will set the imports in `index.html`, and the basename for routes in React. + +Options: +- Any path, eg `"/soapbox"` or `"/fe/soapbox"` + +Default: `"/"` + +For example, if you want to host the build on `https://gleasonator.com/soapbox`, you can compile it like this: + +```sh +NODE_ENV="production" FE_BASE_PATH="/soapbox" yarn build +```