How do I specify compression, bundling and adding invalidation hashes to filenames for a custom environment?
The production environment will automatically compress and c
This is configured in ember-cli-build.js
file of your project. By default fingerprinting is only enabled in production (app.env === 'production'
). This could be changed by fingerprint.enabled
option. The same applies to ember-cli-uglify
for JavaScript minification and minifyCSS
options. Configure these options as required:
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
let env = EmberApp.env();
let isProductionLike = ['production', 'qa'].includes(env);
let app = new EmberApp({
'ember-cli-uglify': {
enabled: isProductionLike
},
fingerprint: {
enabled: isProductionLike
},
minifyCSS: {
enabled: isProductionLike
},
sourcemaps: {
enabled: !isProductionLike
}
});
return app.toTree();
};
ember-cli-uglify
option was named minifyJS
in ember-cli-uglify 1.x. The addon was updated in default blueprint of ember-cli 2.16. Change option name accordingly if you are still using ember-cli-uglify@1.x. At the point of time writing this answer, ember-cli docs had not yet reflected that breaking change. It was introduced here. Also note that there is an open issue about it, so it might change in the future again.
More details and options are available in asset compilation chapter of ember-cli docs.