Set environment variables locally

You can set environment variables to test them in your local preview.

Before you start

Steps

To set an environment variable locally:

  1. In your CLI, close the local server if it is running.

  2. Run the following command:

    export BRAND_PRIMARY_COLOR=red

  3. Run the following command to test it:

    echo $BRAND_PRIMARY_COLOR

    You will see the word 'red' appear on your CLI.

    This image shows the CLI with the commands entered as above

    The environment variable is now available in the runtime environment for your component.

  4. Start your local development server. Instruction on how to do this can be found in the Squiz DXP documentation.