summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-12-11 14:40:20 +0100
committerSamy Pessé <samypesse@gmail.com>2015-12-11 14:40:20 +0100
commit49f09e46daf75c192e5d7b6b050fe9f9f949a485 (patch)
treec514b4370a912ba301f62b4f9c90061a454d0824
parentbecd027563f361e7dc6824d18c58978b08aa6118 (diff)
downloadgitbook-49f09e46daf75c192e5d7b6b050fe9f9f949a485.zip
gitbook-49f09e46daf75c192e5d7b6b050fe9f9f949a485.tar.gz
gitbook-49f09e46daf75c192e5d7b6b050fe9f9f949a485.tar.bz2
Fix support for local styles
-rw-r--r--lib/generators/website.js7
-rw-r--r--test/ebook.js10
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/generators/website.js b/lib/generators/website.js
index 1143fe5..efb7c0f 100644
--- a/lib/generators/website.js
+++ b/lib/generators/website.js
@@ -49,7 +49,12 @@ Generator.prototype.prepareStyles = function() {
this.styles = _.chain(this.styles)
.map(function(style) {
var stylePath = that.options.styles[style];
- if (stylePath && fs.existsSync(that.book.resolveOutput(stylePath))) {
+ var styleExists = (
+ fs.existsSync(that.book.resolveOutput(stylePath)) ||
+ fs.existsSync(that.book.resolve(stylePath))
+ );
+
+ if (stylePath && styleExists) {
return [style, stylePath];
}
return null;
diff --git a/test/ebook.js b/test/ebook.js
index 6c84462..5caf28b 100644
--- a/test/ebook.js
+++ b/test/ebook.js
@@ -36,6 +36,11 @@ describe('eBook generator', function () {
});
});
+ it('should correctly copy print.css', function() {
+ book.should.have.file('styles');
+ book.should.have.file('styles/print.css');
+ });
+
it('should remove default print.css', function() {
var PAGE = fs.readFileSync(
path.join(book.options.output, 'index.html'),
@@ -61,10 +66,5 @@ describe('eBook generator', function () {
}
});
});
-
- it('should correctly copy print.css', function() {
- book.should.have.file('styles');
- book.should.have.file('styles/print.css');
- });
});
});