-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
34 lines (25 loc) · 812 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
30
31
32
33
34
/* eslint-env node */
'use strict';
const BroccoliFileSize = require('broccoli-file-size');
const merge = require('merge');
module.exports = {
name: 'ember-cli-broccoli-file-size',
included(app) {
this._super.included.apply(this, arguments)
const env = process.env.EMBER_ENV
this.options = merge.recursive({}, this._getAddonOptions(app)["ember-cli-broccoli-file-size"]);
if (this.options.enabled) {
this.ui.writeLine("ember-cli-broccoli-file-size enabled.");
}
},
_getAddonOptions(app) {
return (this.parent && this.parent.options) || (app && app.options) || {}
},
postprocessTree(type, tree) {
if (!this.options.enabled) {
return;
}
const outTree = new BroccoliFileSize(tree, this.options.broccoliFileSizeOptions);
return outTree;
}
};