forked from pogopaule/ember-countup
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
35 lines (27 loc) · 903 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
/* eslint-env node */
'use strict';
const path = require('path');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
const map = require('broccoli-stew').map;
module.exports = {
name: 'ember-countup',
included: function () {
this._super.included.apply(this, arguments);
let findHost = this._findHost;
let app = findHost.call(this);
this.app = app;
app.import('vendor/countUp.js');
},
treeForVendor: function (vendorTree) {
let countupTree = new Funnel(path.join(this.project.root, 'node_modules', 'countup.js', 'dist'));
//Only add if not FastBoot
countupTree = map(countupTree, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
let trees = [countupTree];
// Check if vendor tree is null
if (vendorTree) {
trees.push(vendorTree);
}
return new MergeTrees(trees);
},
};