summaryrefslogtreecommitdiffstats
path: root/lib/generate/site/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generate/site/index.js')
-rw-r--r--lib/generate/site/index.js40
1 files changed, 22 insertions, 18 deletions
diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js
index a694f39..99f5fb3 100644
--- a/lib/generate/site/index.js
+++ b/lib/generate/site/index.js
@@ -23,6 +23,16 @@ var Generator = function() {
};
util.inherits(Generator, BaseGenerator);
+// Add template loading to load
+Generator.prototype.load = function() {
+ var that = this;
+
+ return BaseGenerator.prototype.load.apply(this)
+ .then(function() {
+ return that.loadTemplates();
+ });
+};
+
// Load all templates
Generator.prototype.loadTemplates = function() {
this.template = swig.compileFile(
@@ -36,16 +46,6 @@ Generator.prototype.loadTemplates = function() {
);
};
-// Load plugins
-Generator.prototype.loadPlugins = function() {
- var that = this;
-
- return BaseGenerator.prototype.loadPlugins.apply(this)
- .then(function() {
- return that.loadTemplates();
- });
-};
-
// Generate a template
Generator.prototype._writeTemplate = function(tpl, options, output, interpolate) {
var that = this;
@@ -118,16 +118,20 @@ Generator.prototype.prepareFile = function(content, _input) {
return _callHook("page:before");
})
.then(function() {
- // Lex page
- return parse.lex(page.content);
- })
- .then(function(lexed) {
- page.lexed = lexed;
-
+ // Lex, parse includes and get
// Get HTML generated sections
- return parse.page(lexed, {
- dir: path.dirname(_input) || '/',
+ return parse.page(page.content, {
+ // Directories to search for includes
+ dir: [
+ // Local files path
+ path.dirname(_input) || '/',
+ // Project's include folder
+ path.join(that.options.input, '_includes'),
+ ],
+ // Output directory
outdir: path.dirname(_input) || '/',
+ // Templating variables
+ variables: that.variables,
});
})
.then(function(sections) {