summaryrefslogtreecommitdiffstats
path: root/lib/output
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output')
-rw-r--r--lib/output/generateBook.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/output/generateBook.js b/lib/output/generateBook.js
index 6fcade0..f17997c 100644
--- a/lib/output/generateBook.js
+++ b/lib/output/generateBook.js
@@ -4,6 +4,7 @@ var Immutable = require('immutable');
var Output = require('../models/output');
var Config = require('../models/config');
var Promise = require('../utils/promise');
+var fs = require('../utils/fs');
var callHook = require('./callHook');
var preparePlugins = require('./preparePlugins');
@@ -164,6 +165,17 @@ function generateBook(generator, book, options) {
generator: generator.name
})
)
+
+ // Cleanup output folder
+ .then(function(output) {
+ var logger = output.getLogger();
+ var rootFolder = output.getRoot();
+
+ logger.debug.ln('cleanup folder "' + rootFolder + '"');
+ return fs.ensureFolder(rootFolder)
+ .thenResolve(output);
+ })
+
.then(processOutput.bind(null, generator))
// Log duration and end message