-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
29 lines (27 loc) · 854 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* jshint node: true */
'use strict';
var logger = require('heimdalljs-logger')('ember-cli-optimize');
module.exports = {
name: 'ember-cli-optimize',
included: function(app) {
this.app = app;
var options = app.options.optimize || {};
if (options.enabled === undefined) {
options.enabled = app.env === 'production';
}
logger.trace('included ' + app.project.name());
this.options = options;
if (app.options.sourcemaps && app.options.sourcemaps.enabled) {
logger.warn('does not work with sourcemaps currently');
}
},
postprocessTree: function(type, tree) {
var app = this.app;
var options = this.options;
if(options.enabled && type === 'all') {
logger.trace('postprocessTree ' + app.project.name());
return require('./lib/optimize')(tree, options);
}
return tree;
}
};