Skip to content

Commit cceebb4

Browse files
committed
Merge branch 'improve/template-blocks'
2 parents afd5465 + d699dff commit cceebb4

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/configuration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Configuration.prototype.load = function() {
100100

101101
try {
102102
configPath = require.resolve(
103-
path.resolve(that.book.root, that.options.configFile)
103+
that.book.resolve(that.options.configFile)
104104
);
105105

106106
// Invalidate node.js cache for livreloading
@@ -125,7 +125,7 @@ Configuration.prototype.load = function() {
125125
that.book.log.warn.ln("gitbook version specified in your book.json might be too strict for future patches, \""+(_.first(pkg.version.split("."))+".x.x")+"\" is more adequate");
126126
}
127127

128-
that.options.output = path.resolve(that.options.output || path.join(that.book.root, "_book"));
128+
that.options.output = path.resolve(that.options.output || that.book.resolve("_book"));
129129
that.options.plugins = normalizePluginsList(that.options.plugins);
130130
that.options.defaultsPlugins = normalizePluginsList(that.options.defaultsPlugins || "");
131131
that.options.plugins = _.union(that.options.plugins, that.options.defaultsPlugins);

lib/generator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ BaseGenerator.prototype.convertFile = function(input) {
3636
// Copy file to the output (non parsable)
3737
BaseGenerator.prototype.transferFile = function(input) {
3838
return fs.copy(
39-
path.join(this.book.root, input),
39+
this.book.resolve(input),
4040
path.join(this.options.output, input)
4141
);
4242
};
@@ -53,8 +53,8 @@ BaseGenerator.prototype.copyCover = function() {
5353
var that = this;
5454

5555
return Q.all([
56-
fs.copy(path.join(that.book.root, "cover.jpg"), path.join(that.options.output, "cover.jpg")),
57-
fs.copy(path.join(that.book.root, "cover_small.jpg"), path.join(that.options.output, "cover_small.jpg"))
56+
fs.copy(that.book.resolve("cover.jpg"), path.join(that.options.output, "cover.jpg")),
57+
fs.copy(that.book.resolve("cover_small.jpg"), path.join(that.options.output, "cover_small.jpg"))
5858
])
5959
.fail(function() {
6060
// If orignaly from multi-lang, try copy from parent

lib/generators/website.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Generator.prototype.prepareStyles = function() {
5050
this.styles = _.chain(this.styles)
5151
.map(function(style) {
5252
var stylePath = that.options.styles[style];
53-
if (stylePath && fs.existsSync(path.resolve(that.book.root, stylePath))) {
53+
if (stylePath && fs.existsSync(that.book.resolve(stylePath))) {
5454
return [style, stylePath];
5555
}
5656
return null;

lib/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var BookLoader = nunjucks.Loader.extend({
3030
git.resolveFile(fileurl)
3131
.then(function(filepath) {
3232
// Is local file
33-
if (!filepath) filepath = path.resolve(that.book.root, fileurl);
33+
if (!filepath) filepath = that.book.resolve(fileurl);
3434
else that.book.log.debug.ln("resolve from git", fileurl, "to", filepath)
3535

3636
// Read file from absolute path

0 commit comments

Comments
 (0)