-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
46 lines (34 loc) · 878 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
36
37
38
39
40
41
42
43
44
45
46
/**
* Object holding compilers and utilities.
* @module compilers
*/
var async = require( 'async' );
var stream = require( '../stream' );
var loader = require( '../markdown-loader' );
module.exports = {
html: require( './html' ),
css: require( './css' ),
js: require( './js' )
};
/**
* Async function that compiles everything
* @param {Function} done
*/
module.exports.compileAll = function( done ) {
loader.load( function() {
async.parallel( [
module.exports.html.compile,
module.exports.css.compile,
module.exports.js.compile
], done );
} );
};
/**
* Pipes given file type into given stream.
* @param {string} type
* @param {Stream} target_stream
*/
module.exports.pipe = function( type, target_stream ) {
var compiled = module.exports[ type ].result;
stream.readString( compiled ).pipe( target_stream );
};