Skip to content

Replace Variables #159

Open
Open
@moonglum

Description

@moonglum

In order to address the growing adoption of the env.NODE_ENV for communicating if the code is running in production or development, we need to find a way to replace variables. This should not be specific to this pattern, but also not as general as "replace any variable with anything". Why? The idea of replacing a variable at build time contradicts the philosophy of faucet to be replaceable, i.e. to not do anything "special" to the code. We stray from that path only when it is necessary (asset-url is the example from faucet-pipeline-sass/css). In this case, we see that it is necessary and want to limit the power of the replacement to keys of one object on purpose.

Proposal:

{
  js: [{
    ...,
    env: { NODE_ENV: "foo", "FOO": "Bar" }
  }]
}

Logic to determine if something is in production or not (for example by reading an ENV variable) can be written by the author of the config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions