diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-14 22:19:40 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-14 22:19:40 +0100 |
commit | 3382f1b0840a7759508357acf88d770f2c5bcaf2 (patch) | |
tree | 56f1041ae643392e44a6053b4354152a9bd3a7b5 /lib/generate/site/index.js | |
parent | 7d90cd2a9ea729566118f617f0d5674a02d04652 (diff) | |
download | gitbook-3382f1b0840a7759508357acf88d770f2c5bcaf2.zip gitbook-3382f1b0840a7759508357acf88d770f2c5bcaf2.tar.gz gitbook-3382f1b0840a7759508357acf88d770f2c5bcaf2.tar.bz2 |
Include styles in website format
Diffstat (limited to 'lib/generate/site/index.js')
-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, |