forked from intuitivepixel/ember-table-addon
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Brocfile.js
35 lines (30 loc) · 941 Bytes
/
Brocfile.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
/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
var fs = require('fs');
// TODO(azirbel): Use something more legit
function htmlEntities(str) {
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
}
var app = new EmberAddon({
/*
* Replace patterns. We use this to replace strings such as:
* @@{controllers/file.js}
* With the content of those files.
*/
replace: {
files: [
'**/*.js'
],
patterns: [{
match: /@@{[^}]*}/g,
replacement: function(matchedText) {
filename = matchedText.slice(3, -1);
fullFilename = './tests/dummy/app/' + filename;
fileContents = fs.readFileSync(fullFilename, 'utf8');
return htmlEntities(fileContents).replace(/\n/g, '\\n');
}
}]
}
});
app.import(app.bowerDirectory + '/d3/d3.js');
module.exports = app.toTree();