forked from ef4/ember-sass-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (32 loc) · 1018 Bytes
/
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
/* eslint-env node */
'use strict';
const path = require('path');
const stew = require('broccoli-stew');
const fbTransform = require('fastboot-transform');
module.exports = {
name: 'ember-sass-bootstrap',
treeForStyles() {
return stew.mv(bootstrapAssetPath('stylesheets'), '.');
},
treeForPublic() {
return stew.mv(bootstrapAssetPath('fonts'), 'fonts');
},
treeForVendor() {
return fbTransform(stew.mv(bootstrapAssetPath('javascripts'), 'bootstrap'));
},
included(app) {
while (app.app) {
app = app.app;
}
let plugins = (app.options.bootstrap || {}).plugins;
if (Array.isArray(plugins)) {
plugins.forEach(name => app.import('vendor/bootstrap/bootstrap/' + name + '.js'));
} else if (typeof plugins === 'undefined' || plugins) {
app.import('vendor/bootstrap/bootstrap.js');
}
}
};
function bootstrapAssetPath(which) {
let bootstrapPath = require.resolve('bootstrap-sass');
return path.join(path.dirname(bootstrapPath), '..', which);
}