Skip to content

Delrifai/#allow env level configuration of default site colors

Step-by-Step Implementation Step 1: Set Up Environment Variables in .env

Step 2: Create a Utility Function to Apply CSS Variables utils/CSSVariables.ts Sets the theme and colors per the environment variables notes : 1) we pulled the variables from from public/__ENV.js instead of the .env file, since environmental variables are built using the @beam-australia/react-env package which pulls environment variables from ) .env files. These files contain variables such as REACT_APP_API_URL, and the package allows you to access these values in your React code without directly using process.env. The package reads the .env file at build time and makes the variables available within the React app.

2) Make sure to rebuild if you change the .env file 
3) Do not commit .env file
4) for more information check README.md

Step 3: Call the Utility Function in components/ThemeToggle.tsx

Merge request reports

Loading