Help with compilation process

Hi everyone!

We are using ember-cli to compile our Ember app. In production env, we need to create the asset files minified and fingerprinted. The final name of the asset need to be someting like: assetname-checksum.min.css (or js).

We have the the following broccoli packages:

  • ember-cli-compass-compiler: to create css files.
  • broccoli-uglify-js: ember-cli default uglifying js package.
  • broccoli-asset-rev: addon to fingerprint files

With those packages we have no option to configure the dest file name with “.min”

Any ideas about how to add the ‘.min’ in the filename before the extension of the file??

Well after a hard search I could get to a solution… rename of filenames to add the ‘.min’ before the file extension and rewriting the link references on index.html to those files. Here is my solution added at bottom of brocfile.js:

var renameFiles = require('broccoli-rename-files');
var assetRewrite = require('broccoli-asset-rewrite');    
var completeTree = app.toTree();
var generatedMap = {};

completeTree = renameFiles(completeTree, {
  transformFilename: function(fileName, baseName, extension) {
    if (['.css', '.js'].indexOf(extension) > -1) {
      generatedMap['assets/' + fileName] = 'assets/' + baseName + '.min' + extension;
      return baseName + '.min' + extension;
    }
    return baseName + extension;
  }
});
completeTree = assetRewrite(completeTree, {
  assetMap: generatedMap,
  replaceExtensions: ['html']
    });
module.exports = completeTree;