Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3d1746

Browse files
committed
Fix use of cover.jpg in ebook
1 parent ac900aa commit e3d1746

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bin/gitbook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ build.command(prog.command('pdf [source_dir]'))
9292

9393
build.command(prog.command('ebook [source_dir]'))
9494
.description('Build a gitbook as a eBook')
95-
.option('-c, --cover <path>', 'Cover image, default is cover.png if exists')
95+
.option('-c, --cover <path>', 'Cover image, default is cover.jpg if exists')
9696
.action(function(dir, options) {
9797
var ext = options.output ? path.extname(options.output) : "epub";
9898

lib/generate/ebook/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ var Generator = function() {
1919
this.options = _.defaults(this.options, {
2020
extension: "epub"
2121
});
22-
23-
if (!this.options.cover && fs.existsSync(path.join(this.options.input, "cover.png"))) {
24-
this.options.cover = path.join(this.options.input, "cover.png")
25-
}
2622
};
2723
util.inherits(Generator, BaseGenerator);
2824

@@ -37,6 +33,10 @@ Generator.prototype.finish = function() {
3733
"--cover": that.options.cover
3834
};
3935

36+
if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) {
37+
that.options.cover = path.join(that.options.output, "cover.jpg");
38+
}
39+
4040
var command = [
4141
"ebook-convert",
4242
path.join(that.options.output, "index.html"),

0 commit comments

Comments
 (0)