Ember-cli-deploy, different build targets

Since this is something related to how the app is built, you’ll probably want to handle that in your ember-cli-build.js file.

Assuming you have this at the top:

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

…then somewhere in your build configuration, you could add:

if (EmberApp.env() === 'production2') {
  app.import('some/other/styles.css');
}

That stylesheet would get pulled into the CSS build only when the environment is production2.

That being said, I think it’s frowned upon to use non-standard environments. Addons (mirage, for example) will make decisions on what to do based on the current environment. If it’s an unexpected environment, I’m not sure there’s a clear strategy for how to handle that.

So, an alternative might be to use environment variables when making decisions in your build. (Ember-cli-deploy uses dotenv, so might be worth working through that re environment variables). But, if you wanted to have a PROD_ENV variable just when doing the deploy, you could do:

if (process.env.PROD_ENV === 'envNumbah2') {
  app.import('some/other/styles.css');
}

And when building:

env PROD_ENV=envNumbah2 ember deploy production

We’ve done something similar to this for building our config/environment.js file. Seems to be working well so far.

I’m certainly curious if anyone has any other strategies for this too!