diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cli/helper.js | 3 | ||||
-rw-r--r-- | lib/cli/index.js | 2 | ||||
-rw-r--r-- | lib/output/base.js | 5 | ||||
-rw-r--r-- | lib/output/folder.js | 7 |
4 files changed, 12 insertions, 5 deletions
diff --git a/lib/cli/helper.js b/lib/cli/helper.js index 1086b4d..6dae58c 100644 --- a/lib/cli/helper.js +++ b/lib/cli/helper.js @@ -1,4 +1,5 @@ var _ = require('lodash'); +var path = require('path'); var Book = require('../book'); var NodeFS = require('../fs/node'); @@ -36,7 +37,7 @@ var FORMATS = { // the root of the book is the first argument (or current directory) function bookCmd(fn) { return function(args, kwargs) { - var input = args[0] || process.cwd(); + var input = path.resolve(args[0] || process.cwd()); var book = new Book({ fs: new NodeFS(), root: input, diff --git a/lib/cli/index.js b/lib/cli/index.js index 0492c29..07c4888 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -94,7 +94,7 @@ module.exports = { helper.options.log ], exec: function(args, kwargs) { - var input = args[0] || process.cwd(); + var input = path.resolve(args[0] || process.cwd()); var server = new Server(); // Init livereload server diff --git a/lib/output/base.js b/lib/output/base.js index 6678bb0..2a7ec48 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -76,12 +76,12 @@ Output.prototype.generate = function() { .value(); return Promise.serie(byTypes.asset, function(filename) { - that.log.info.ln('copy asset', filename); + that.log.debug.ln('copy asset', filename); return that.onAsset(filename); }) .then(function() { return Promise.serie(byTypes.page, function(filename) { - that.log.info.ln('process page', filename); + that.log.debug.ln('process page', filename); return that.onPage(that.book.getPage(filename)); }); }); @@ -154,6 +154,7 @@ Output.prototype.onOutputSVG = function(page, svg) { // Output an image as a file // Normalize the relative link Output.prototype.onOutputImage = function(page, imgFile) { + imgFile = page.resolveLocal(imgFile); return page.relative(imgFile); }; diff --git a/lib/output/folder.js b/lib/output/folder.js index 14e3f22..9e139c0 100644 --- a/lib/output/folder.js +++ b/lib/output/folder.js @@ -88,7 +88,12 @@ module.exports = function folderOutput(Base) { return Promise() .then(function() { to = that.resolve(to); + var folder = path.dirname(to); + // Ensure folder exists + return fs.mkdirp(folder); + }) + .then(function() { return fs.copy(from, to); }); }; @@ -102,7 +107,7 @@ module.exports = function folderOutput(Base) { filename = that.resolve(filename); var folder = path.dirname(filename); - // Ensure fodler exists + // Ensure folder exists return fs.mkdirp(folder); }) |