-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathindex.js
46 lines (40 loc) · 1.36 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
var path = require('path');
var defaults = require('./lib/default-options');
module.exports = {
name: 'broccoli-asset-rev',
initializeOptions: function() {
var defaultOptions = {
enabled: this.app.env === 'production',
exclude: defaults.exclude,
extensions: defaults.extensions,
prepend: defaults.prepend,
replaceExtensions: defaults.replaceExtensions
};
// Allow simply setting { fingerprint: false } as a shortcut option to disable
if (this.app.options.fingerprint === false) {
this.options = this.app.options.fingerprint = { enabled: false };
} else {
this.options = this.app.options.fingerprint = this.app.options.fingerprint || {};
}
for (var option in defaultOptions) {
if (!this.options.hasOwnProperty(option)) {
this.options[option] = defaultOptions[option];
}
}
},
postprocessTree: function (type, tree) {
if (type === 'all' && this.options.enabled) {
tree = require('./lib/asset-rev')(tree, this.options);
}
return tree;
},
included: function (app) {
this.app = app;
this.initializeOptions();
},
treeFor: function() {},
// ember-cli-fastboot uses the presence of this flag to give a
// helpful error if you're using an older version of this addon that
// doesn't know how to rewrite the fastboot manifest.
supportsFastboot: true
};