This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
63 lines (46 loc) · 1.68 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* global module, require */
/* eslint-env node */
'use strict';
const path = require('path');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'nsf-ember-tooltip',
included() {
let app;
// If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just use that.
if (typeof this._findHost === 'function') {
app = this._findHost();
}
else {
// Otherwise, we'll use this implementation borrowed from the _findHost() method in ember-cli.
let current = this;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
}
this.app = app;
this.addonConfig = this.app.project.config(app.env)['nsf-ember-tooltip'] || {};
this._super.included.apply(this, arguments);
this.import('vendor/tooltipster.bundle.js');
this.import('vendor/tooltipster-scrollableTip.js');
if (!this.addonConfig.excludeDefaultStyles) {
this.import('vendor/tooltipster.bundle.css');
}
},
treeForVendor() {
const trees = [];
trees.push(new Funnel(path.dirname(require.resolve('tooltipster/dist/js/tooltipster.bundle.js')), {
files: ['tooltipster.bundle.js'],
}));
trees.push(new Funnel(path.dirname(require.resolve('tooltipster-scrollabletip/tooltipster-scrollableTip.js')), {
files: ['tooltipster-scrollableTip.js'],
}));
if (!this.addonConfig.excludeDefaultStyles) {
trees.push(new Funnel(path.dirname(require.resolve('tooltipster/dist/css/tooltipster.bundle.css')), {
files: ['tooltipster.bundle.css'],
}));
}
return new MergeTrees(trees);
},
};