I tried to search in google this but without the correct answer if I need to do.
It's a simple question I have my ember-cli-build.js
/*jshint node:true*/
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
storeConfigInMeta: false,
minifyJS: {
enabled: false
},
minifyCSS: {
enabled: false
}
});
return app.toTree();
};
And I want change the value of minifyJS or minifyCSS depending on whether I am running ember in production or dev - how can achieve that?
This answer applies to Ember 2.x.x and was written as of 2.15.
In your ember-cli-build.js
you can do EmberApp.env()
to get the environment. You could also do process.env.EMBER_ENV
but the first option is in the Ember CLI Docs, so I'd go with that personally.
Example:
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var enableMin = (EmberApp.env() === 'production');
var app = new EmberApp(defaults, {
storeConfigInMeta: false,
minifyJS: {
enabled: enableMin
},
minifyCSS: {
enabled: enableMin
}
});
return app.toTree();
};