diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-05-21 17:34:36 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-05-21 17:34:36 +0200 |
commit | c7439d12f7533a9a54218e58f18033c29b60bc6b (patch) | |
tree | 473b7e20c946a4fc918d8fa8221dbc3571f6e4c1 /lib/generate/index.js | |
parent | 8d6923ce2cb0d6508a95435afb0cc51045cacaf6 (diff) | |
download | gitbook-c7439d12f7533a9a54218e58f18033c29b60bc6b.zip gitbook-c7439d12f7533a9a54218e58f18033c29b60bc6b.tar.gz gitbook-c7439d12f7533a9a54218e58f18033c29b60bc6b.tar.bz2 |
Add livereload as default plugins only for serve
Diffstat (limited to 'lib/generate/index.js')
-rw-r--r-- | lib/generate/index.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js index 8c6450c..8bb7052 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -64,6 +64,7 @@ var generate = function(options) { // Plugins "plugins": [], "pluginsConfig": {}, + "defaultsPlugins": [], // Default plugins that can't be set in book.json // Links "links": { @@ -86,6 +87,21 @@ var generate = function(options) { // Check files to get folder type (book, multilanguage book or neither) return Q() + // Read config file + .then(function() { + return fs.readFile(path.resolve(options.input, options.configFile)) + .then(function(_config) { + // Extend current config + _config = JSON.parse(_config); + _config = _.omit(_config, 'input', 'configFile', 'defaultsPlugins'); + + _.extend(options, _config); + }, function() { + // No config file: not a big deal + return Q(); + }); + }) + // Read readme .then(function() { return fs.readFile(path.join(options.input, "README.md"), "utf-8") @@ -177,21 +193,6 @@ var generateBook = function(options) { } }) - // Read config file - .then(function() { - return fs.readFile(path.resolve(options.input, options.configFile)) - .then(function(_config) { - // Extend current config - _config = JSON.parse(_config); - _config = _.omit(_config, 'input', 'configFile'); - - _.extend(options, _config); - }, function() { - // No config file: not a big deal - return Q(); - }); - }) - // Clean output folder .then(function() { return fs.remove(options.output); |