-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
46 lines (39 loc) · 1.43 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
/* eslint-env node */
'use strict';
const Funnel = require('broccoli-funnel'),
MergeTrees = require('broccoli-merge-trees'),
path = require('path'),
fastbootTransform = require('fastboot-transform');
module.exports = {
name: 'ember-cli-webfontloader',
treeForVendor(vendorTree) {
let webfontloaderTree = fastbootTransform(new Funnel(path.join(this.project.root, 'node_modules', 'webfontloader'), {
files: ['webfontloader.js']
}));
return new MergeTrees([vendorTree, webfontloaderTree]);
},
included() {
this._super.included.apply(this, arguments);
this._ensureThisImport();
this.import('vendor/webfontloader.js');
this.import('vendor/shims/webfontloader.js');
},
// ember 2.7 < compatibility:
// https://github.com/simplabs/ember-simple-auth/blob/1ca4ae678b7be9905076762220dcd9fcb0f27ac0/index.js#L24-L39
_ensureThisImport: function() {
if (!this.import) {
this._findHost = function findHostShim() {
var current = this;
var app;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
return app;
};
this.import = function importShim(asset, options) {
var app = this._findHost();
app.import(asset, options);
};
}
}
};