-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.js
66 lines (56 loc) · 1.44 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
60
61
62
63
64
65
66
'use strict';
var Fittings = require('fittings')
, join = require('path').join
, fs = require('fs');
/**
* Read files out of our instructions directory.
*
* @param {String} file Filename that we should read.
* @returns {String}
* @api private
*/
function read(file) {
return fs.readFileSync(join(__dirname, 'instructions', file), 'utf-8');
}
//
// Expose the fittings definition for the BigPipe.js client library which
// processes all the magic.
//
Fittings.extend({
//
// Required name to identify the framework being pushed into Fittings.
//
name: 'bigpipe',
//
// The template that is flushed to the client every single time a pagelet is
// ready to write it's output. We split it so we can minify all the things.
//
fragment: read('fragment.html').split('\n').join(''),
//
// Library bootstrap which will be passed into the bootstrap pagelet.
//
bootstrap: read('bootstrap.html'),
//
// Wrapping template to introduce client-side templates.
//
template: read('template.js'),
//
// Wrapping template to introduce plugin client code.
//
plugin: read('plugin.js'),
//
// Reference(s) to the library files that should be loaded.
//
library: require.resolve('./bigpipe.js'),
//
// Additional plugins.
//
use: {
css: {
server: function server(bigpipe) {
var compiler = bigpipe._compiler;
compiler.on('assembly', compiler.namespace);
}
}
}
}).on(module);