ember-cli / broccoli-asset-rev

Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
MIT License
86 stars 83 forks source link

Set enabled based on environment #31

Closed piotrpalek closed 9 years ago

piotrpalek commented 9 years ago

I wanted to set the enabled flag to true when I am on staging as well and had to do it this way:

var env = process.env.EMBER_ENV

var app = new EmberApp({
  fingerprint: {
    enabled: env === 'staging' || env === 'production'
  }
});

Is this the way to do it or am I missing something? I mean I am not sure if I should use the env variable explicitly like this (instead of using it through app.env).

rickharrison commented 9 years ago

Yes, that is the correct way to do it. The default is this.app.env === 'production' so I would probably use this.app.env

piotrpalek commented 9 years ago

Well the issue here is that you don't (yet) have the app object. And this refers to the global variable in this context (whatever that variable is). So I couldn't really use this.app.env === 'production', it seems the way I've done it is the only way.

rickharrison commented 9 years ago

Sorry, its been a while since I've worked with ember-cli. But yea, that looks good to me then.