Skip to content
Petr Kosikhin edited this page Oct 24, 2016 · 12 revisions

Previous: Installation | Next: Options


Default Options

After installing this addon you will be able to set many options in your Brocfile.js / ember-cli-build.js to control the concatenation of javascript and CSS in your app. The default options are shown below

// ember-cli-build.js

var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    emberCliConcat: {
      enabled: true,
      outputDir: 'assets',
      outputFileName: 'app',
      useSelfClosingTags: false,
      wrapScriptsInFunction: false,
      treeTypes: ['all'],

      js: {
        concat: false,
        contentFor: 'concat-js',
        footer: null,
        header: null,
        preserveOriginal: true
      },

      css: {
        concat: false,
        contentFor: 'concat-css',
        footer: null,
        header: null,
        preserveOriginal: true
      },
    }
  });
  return app.toTree();
};

Environments

You can have different concatenation settings for each environment. You can do this as follows:

// Brocfile.js

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
var environment = process.env.EMBER_ENV;

var options = {
  storeConfigInMeta: false,
  fingerprint: {
    enabled: false,
  },
  emberCliConcat: {
    /* Test custom options here */
  }
};

if (environment === 'production') {
  options.emberCliConcat = {
    css: {
      concat: true
    },
    js: {
      concat: true
    }
  }
}

var app = new EmberAddon(options);

module.exports = app.toTree();

Previous: Installation | Next: Options

Clone this wiki locally