forked from cibernox/ember-basic-dropdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (34 loc) · 1.18 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
'use strict';
module.exports = {
name: require('./package').name,
included(appOrAddon) {
let app = appOrAddon.app || appOrAddon;
if (app.__emberBasicDropdownIncludedInvoked) {
this._super.included.apply(this, arguments);
return;
}
app.__emberBasicDropdownIncludedInvoked = true;
this._super.included.apply(this, arguments);
let hasSass = !!app.registry.availablePlugins['ember-cli-sass'];
let hasLess = !!app.registry.availablePlugins['ember-cli-less'];
// Don't include the precompiled css file if the user uses a supported CSS preprocessor
if (!hasSass && !hasLess) {
if (!app.__skipEmberBasicDropdownStyles) {
app.import('vendor/ember-basic-dropdown.css');
}
}
},
contentFor(type, config) {
let basicDropdownConfig = config['ember-basic-dropdown'];
if (!basicDropdownConfig || !basicDropdownConfig.destination) {
if (
config.environment !== 'test' &&
type === 'body-footer' &&
!config._emberBasicDropdownContentForInvoked
) {
config._emberBasicDropdownContentForInvoked = true;
return '<div id="ember-basic-dropdown-wormhole"></div>';
}
}
},
};