diff options
-rw-r--r-- | lib/generate/config.js | 3 | ||||
-rw-r--r-- | lib/generate/index.js | 13 |
2 files changed, 5 insertions, 11 deletions
diff --git a/lib/generate/config.js b/lib/generate/config.js index a250a3c..ad9c697 100644 --- a/lib/generate/config.js +++ b/lib/generate/config.js @@ -13,6 +13,9 @@ var CONFIG = { // It's not advised this option in the book.json "generator": "site", + // Configuration file to use + "configFile": "book", + // Book title and description (defaults are extracted from the README) "title": null, "description": null, diff --git a/lib/generate/index.js b/lib/generate/index.js index c9d6e5c..c71e0a6 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -49,14 +49,7 @@ var loadGenerator = function(options) { var generate = function(options) { // Set defaults to options - options = _.defaults(options || {}, { - // Config file (relative to input) - "configFile": "book", - - // Output generator - "generator": "site" - }); - //options = _.merge(options || {}, defaultConfig, _.defaults); + options = defaultConfig.defaults(options); // Validate options if (!options.input) { @@ -71,14 +64,12 @@ var generate = function(options) { try { var _config = require(path.resolve(options.input, options.configFile)); - _.extend(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins')); + options = _.merge(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins')); } catch(err) { // No config file: not a big deal return Q(); } - - options = defaultConfig.defaults(options); }) // Read readme |