-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
41 lines (32 loc) · 1.01 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
/* jshint node: true */
'use strict';
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-pdf-js',
included: function(app) {
app.import('vendor/pdf-js/l10n.js');
app.import(app.bowerDirectory + '/pdfjs-dist/build/pdf.js');
app.import(app.bowerDirectory + '/pdfjs-dist/web/compatibility.js');
},
contentFor: function(type, config) {
if(type === 'head') {
return '<link rel="resource" type="application/l10n" href="assets/ember-cli-pdf-js/locale/locale.properties"/>';
}
},
treeForPublic: function(tree) {
this._requireBuildPackages();
if (!tree) {
return tree;
}
var pdfJsWorkerTree = this.pickFiles(this.app.bowerDirectory + '/pdfjs-dist/build',{
srcDir: '/',
files: ['pdf.worker.js'],
destDir: 'assets/' + this.moduleName()
});
var publicTree = this.pickFiles(tree, {
srcDir: '/',
destDir: 'assets/' + this.moduleName()
});
return mergeTrees([publicTree, pdfJsWorkerTree]);
}
};