diff options
Diffstat (limited to 'lib/generate/site')
-rw-r--r-- | lib/generate/site/index.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index 94ee6c0..dfdbf68 100644 --- a/lib/generate/site/index.js +++ b/lib/generate/site/index.js @@ -18,6 +18,7 @@ var Generator = function() { // Attach methods to instance _.bindAll(this); + this.styles = ["website"]; this.revision = Date.now(); this.indexer = indexer(); }; @@ -29,10 +30,28 @@ Generator.prototype.load = function() { return BaseGenerator.prototype.load.apply(this) .then(function() { + return that.loadStyles(); + }) + .then(function() { return that.loadTemplates(); }); }; +// Load all styles +Generator.prototype.loadStyles = function() { + var that = this; + this.styles = _.chain(this.styles) + .map(function(style) { + var stylePath = that.options.styles[style]; + if (fs.existsSync(path.resolve(that.options.input, stylePath))) { + return stylePath; + } + return null; + }) + .compact() + .value(); +}; + // Load all templates Generator.prototype.loadTemplates = function() { this.template = swig.compileFile( @@ -54,6 +73,8 @@ Generator.prototype._writeTemplate = function(tpl, options, output, interpolate) return Q() .then(function(sections) { return tpl(_.extend({ + styles: that.styles, + revision: that.revision, title: that.options.title, |