This repository has been archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
59 lines (48 loc) · 1.62 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
/* 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;
const replace = require('broccoli-string-replace');
module.exports = {
name: 'ember-videojs-dash',
included: function (app) {
this._super.included.apply(this, arguments);
app.import({
development: path.join('vendor/dash.all.debug.js'),
production: path.join('vendor/dash.all.min.js')
});
app.import({
development: path.join('vendor/videojs-dash.js'),
production: path.join('vendor/videojs-dash.min.js')
});
},
treeForVendor(vendorTree) {
let trees = [];
if (vendorTree) {
trees.push(vendorTree);
}
//
// Dash Library
let dashLib = new Funnel(path.join(this.project.root, 'node_modules', 'dashjs', 'dist'));
dashLib = map(dashLib, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
//
// Need to replace sourcemap reference because uglify is Angry
let clean = new replace(dashLib, {
files: ['dash.all.min.js'],
patterns: [{
match: /\/\/# sourceMappingURL=dash.all.min.js.map/g,
replacement: ''
}],
annotation: 'remove sourcemap annotation (dashjs)'
});
trees.push(clean);
//
// Videojs Dash
let videojsDash = new Funnel(path.join(this.project.root, 'node_modules', 'videojs-contrib-dash', 'dist'));
videojsDash = map(videojsDash, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`);
trees.push(videojsDash);
return new MergeTrees(trees);
},
};