forked from ember-cli/broccoli-asset-rev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (36 loc) · 1.11 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
var path = require('path');
var assetRev = require('./lib/asset-rev');
module.exports = {
name: 'broccoli-asset-rev',
initializeOptions: function() {
var defaultOptions = {
enabled: this.app.env === 'production',
exclude: [],
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'],
prepend: '',
replaceExtensions: ['html', 'css', 'js']
}
// 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 = assetRev(tree, this.options);
}
return tree;
},
included: function (app) {
this.app = app;
this.initializeOptions();
},
treeFor: function() {}
}