2

We're developing an app using Chaplin on top of brunch.

We're consuming a 3rd party API and we have different tokens for development and production.

I was wondering if it's possible to setup env variables in Brunch. I'd like to compile everything to plain html/js.

Is there a way to compile the project using something like brunch build -env staging? If so, how can I define such variables?

Juanda
  • 1,648
  • 1
  • 20
  • 29

1 Answers1

2

https://github.com/brunch/brunch/issues/332

1) using brunch cmd --environment ...

2) using BRUNCH_ENV=development brunch cmd + process.env.BRUNCH_ENV

Ven
  • 19,015
  • 2
  • 41
  • 61
  • 6
    How can I pass a custom environment variable so that it's available to my JavaScript code? – mcont Nov 23 '16 at 09:47