-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (48 loc) · 1.47 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
/* eslint-env node */
'use strict';
var path = require('path');
var stew = require('broccoli-stew');
var Merge = require('broccoli-merge-trees');
/**
* Lots of this is inspired by (and in some cases directly copied from)
* https://github.com/ef4/ember-sass-bootstrap
*/
function bootstrapAssetPath(which) {
var bootstrapPath = require.resolve('bootstrap');
return path.join(path.dirname(bootstrapPath), '../..', which);
}
module.exports = {
name: 'ember-embark',
treeForStyles: function(tree) {
return new Merge([
tree,
stew.mv(bootstrapAssetPath('scss'), 'bootstrap')
].filter(Boolean));
},
// treeForPublic: function() {
// return stew.mv(bootstrapAssetPath('fonts'), 'fonts');
// },
treeForVendor: function(tree) {
return stew.debug(
new Merge([
tree,
stew.mv(path.join(path.dirname(require.resolve('jquery-sparkline'))), 'jquery-sparkline' ),
stew.mv(bootstrapAssetPath('js/dist'), 'bootstrap')
].filter(Boolean)),
{ name: 'vennndor' }
);
},
included: function(app) {
while (app.app) {
app = app.app;
}
var plugins = (app.options.bootstrap || {}).plugins;
(plugins || ['collapse', 'dropdown', 'button', 'alert', 'util']).forEach(function(name) {
app.import('vendor/bootstrap/' + name + '.js');
});
if (!process.env.EMBER_CLI_FASTBOOT) {
app.import('vendor/jquery-sparkline/jquery.sparkline.js');
}
this._super.included.apply(this, arguments);
}
};