-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
71 lines (57 loc) · 1.16 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
67
68
69
70
71
'use strict';
/**
* module dependencies
*/
var Templates = require('templates');
var utils = require('./utils');
/**
* Create an `assemble` application. This is the main function exported
* by the assemble module.
*
* ```js
* var assemble = require('assemble');
* var app = assemble();
* ```
* @param {Object} `options` Optionally pass default options to use.
* @api public
*/
function Assemble(options) {
if (!(this instanceof Assemble)) {
return new Assemble(options);
}
Templates.call(this, options);
this.is('assemble');
this.initCore();
}
/**
* Inherit `Templates`
*/
Templates.extend(Assemble);
Templates.bubble(Assemble);
/**
* Load core plugins
*/
Assemble.prototype.initCore = function() {
Assemble.initCore(this);
};
/**
* Load core plugins
*/
Assemble.initCore = function(app) {
Assemble.emit('preInit', app);
Assemble.initPlugins(app);
Assemble.emit('init', app);
};
/**
* Load core plugins
*/
Assemble.initPlugins = function(app) {
app.use(utils.tasks(app.name));
app.use(utils.streams());
app.use(utils.render());
app.use(utils.fs());
};
/**
* Expose the `Assemble` constructor
*/
module.exports = Assemble;