-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
53 lines (46 loc) · 1.67 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
/* jshint node: true */
'use strict';
const path = require('path');
const chalk = require('chalk');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ui-bootstrap',
description: 'An Ember-flavoured Bootstrap 4.x eco-system',
included(app, parentAddon) {
const target = (parentAddon || app);
this._super.included(target);
const scssPath = path.join('node_modules', 'bootstrap/scss');
const cssPath = path.join('node_modules', 'bootstrap/dist/css');
if (app.registry.availablePlugins['ember-cli-sass']) {
const sassOptions = app.options.sassOptions || { includePaths: []};
sassOptions.includePaths.push(scssPath);
} else {
this.ui.writeLine(chalk.bold('ui-bootstrap: ') + ' did not detect ' + chalk.bold.green('ember-cli-sass') + ' so using CSS configuration, installing this addon will switch ui-bootstrap to use SASS.');
// target.import(path.join(cssPath, 'bootstrap.css'));
target.import('vendor/ui-bootstrap/bootstrap.css');
}
// ui-bootstrap additions/fixes
target.import('vendor/ui-bootstrap/ui-bootstrap-improvements.css');
},
treeForStyles: function(tree) {
const bootstrapPath = path.join('node_modules', 'bootstrap/scss');
const trees = [];
if(tree) {
trees.push(tree);
}
const existingStyle = this._super.treeForStyles.apply(this, arguments);
const bootstrap = new Funnel(bootstrapPath, {
srcDir: '/',
destDir: '/'
});
trees.push(bootstrap);
if (existingStyle) {
trees.push(existingStyle);
}
return mergeTrees(trees);
},
isDevelopingAddon: function () {
return true;
}
};