diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-06-02 11:00:22 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-06-02 11:00:22 +0200 |
commit | a9a230dfc31d9d5092adda51344b0c9f725d9788 (patch) | |
tree | e9b864c6c0e08d37afce0df70b1a9bffdb3f94a9 /lib | |
parent | 13fb949d6818bc47a2215ee788c392fa38e1e1d6 (diff) | |
parent | 6d53e5277100fe6a9372dea4ab9d70c769a28176 (diff) | |
download | gitbook-a9a230dfc31d9d5092adda51344b0c9f725d9788.zip gitbook-a9a230dfc31d9d5092adda51344b0c9f725d9788.tar.gz gitbook-a9a230dfc31d9d5092adda51344b0c9f725d9788.tar.bz2 |
Merge pull request #781 from GitbookIO/fix/775
Fix #775: add optional print.css style
Diffstat (limited to 'lib')
-rw-r--r-- | lib/configuration.js | 1 | ||||
-rw-r--r-- | lib/generators/ebook.js | 2 | ||||
-rw-r--r-- | lib/generators/website.js | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/configuration.js b/lib/configuration.js index d206505..29776bd 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -186,6 +186,7 @@ Configuration.DEFAULT = { // CSS Styles "styles": { "website": "styles/website.css", + "print": "styles/print.css", "ebook": "styles/ebook.css", "pdf": "styles/pdf.css", "mobi": "styles/mobi.css", diff --git a/lib/generators/ebook.js b/lib/generators/ebook.js index 0bad35a..cff9ef6 100644 --- a/lib/generators/ebook.js +++ b/lib/generators/ebook.js @@ -18,7 +18,7 @@ var Generator = function(book, format) { this.namespace = "ebook"; // Styles to use - this.styles = _.compact(["ebook", this.ebookFormat]); + this.styles = _.compact(["print", "ebook", this.ebookFormat]); // Convert images (svg -> png) this.convertImages = true; diff --git a/lib/generators/website.js b/lib/generators/website.js index 8d1a3c5..de833d3 100644 --- a/lib/generators/website.js +++ b/lib/generators/website.js @@ -50,12 +50,13 @@ Generator.prototype.prepareStyles = function() { this.styles = _.chain(this.styles) .map(function(style) { var stylePath = that.options.styles[style]; - if (fs.existsSync(path.resolve(that.book.root, stylePath))) { - return stylePath; + if (stylePath && fs.existsSync(path.resolve(that.book.root, stylePath))) { + return [style, stylePath]; } return null; }) .compact() + .object() .value(); return Q(); |