-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
80 lines (68 loc) · 1.9 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* jshint node: true */
'use strict';
const path = require('path');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ui-flag',
description: 'quickly and easily display country flags in EmberJS applications',
included(app, parentAddon) {
const target = (parentAddon || app);
this._super.included(target);
const sassOptions = app.options.sassOptions || { includePaths: []};
const bootstrapPath = path.join(app.bowerDirectory, 'flag-icon-css/sass');
sassOptions.includePaths.push(bootstrapPath);
},
treeForStyles: function(tree) {
const flagsScss = path.join('bower_components', 'flag-icon-css/sass');
const trees = [];
if(tree) {
trees.push(tree);
}
const existingStyle = this._super.treeForStyles.apply(this, arguments);
const flags = new Funnel(flagsScss, {
srcDir: '/',
destDir: '/',
exclude: ['variables.scss']
});
trees.push(flags);
// const uiFlagVendor = new Funnel('/ui-flag');
// trees.push(uiFlagVendor);
if (existingStyle) {
trees.push(existingStyle);
}
return mergeTrees(trees);
},
// treeForVendor: function(tree) {
// const vendor = path.join('vendor', 'ui-flag');
// const trees = [];
//
// if(tree) {
// trees.push(tree);
// }
//
// const svgs = new Funnel(vendor, {
// srcDir: '',
// destDir: '/vendor/ui-flag'
// });
// trees.push(svgs);
//
// return mergeTrees(trees);
// },
treeForPublic: function(tree) {
const bootstrapPath = path.join('bower_components', 'flag-icon-css');
const trees = [];
if(tree) {
trees.push(tree);
}
const svgs = new Funnel(bootstrapPath, {
srcDir: '/flags',
destDir: '/flags'
});
trees.push(svgs);
return mergeTrees(trees);
},
isDevelopingAddon: function () {
return true;
}
};