-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (37 loc) · 1.06 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
'use strict';
const broccoliMerge = require('broccoli-merge-trees');
const funnel = require('broccoli-funnel');
const Concat = require('broccoli-concat');
module.exports = {
name: require('./package').name,
isDevelopingAddon() {
return true;
},
treeForPublic(tree) {
let mergedTrees = broccoliMerge(this.app.options.splitSvgs, {
overwrite: true,
});
// my broccoli-fu is weak, so I'm not sure how to do this with a single
// funnel. I'm sure there's a way, but this works for now.
// also need to figure out how to remove the SVGs from public
let splitSvgs = [];
let splitPaths = ['one', 'two'];
splitPaths.forEach((splitPath) => {
let svgTree = funnel(mergedTrees, {
include: [`**/*`],
});
splitSvgs.push(
new Concat(svgTree, {
outputFile: `assets/svgs/${splitPath}.js`,
inputFiles: [`**/${splitPath}/*.js`],
})
);
});
return broccoliMerge(
[tree, ...splitSvgs].filter((row) => !!row),
{
overwrite: true,
}
);
},
};