Set environment variables locally
You can set environment variables to test them in your local preview.
Before you start
-
Complete the Set up your local preview instructions.
-
Understand how to run the local development server.
Steps
To set an environment variable locally:
-
In your CLI, close the local server if it is running.
-
Run the following command:
export BRAND_PRIMARY_COLOR=red
-
Run the following command to test it:
echo $BRAND_PRIMARY_COLOR
You will see the word 'red' appear on your CLI.
The environment variable is now available in the runtime environment for your component.
-
Start your local development server. Instruction on how to do this can be found in the Squiz DXP documentation.