summaryrefslogtreecommitdiffstats
path: root/lib/generate/index.js
diff options
context:
space:
mode:
authorJuho Vepsalainen <bebraw@gmail.com>2014-06-03 15:55:24 +0300
committerJuho Vepsalainen <bebraw@gmail.com>2014-06-03 17:42:30 +0300
commitb6d11d88b78149ee0d235b4f7373caf21115c863 (patch)
tree242b2786cdca2a0d592d1e0bdfab34054ac01bcb /lib/generate/index.js
parentc803270af8c2f7d19de83f2997dbd7fe7675bd54 (diff)
downloadgitbook-b6d11d88b78149ee0d235b4f7373caf21115c863.zip
gitbook-b6d11d88b78149ee0d235b4f7373caf21115c863.tar.gz
gitbook-b6d11d88b78149ee0d235b4f7373caf21115c863.tar.bz2
Allow book.js to be used in addition to book.json
Now it's possible to comment configuration properly and do some dynamic things if needed. Closes #287.
Diffstat (limited to 'lib/generate/index.js')
-rw-r--r--lib/generate/index.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index 520981c..1fb372e 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -54,7 +54,7 @@ var generate = function(options) {
"output": null,
// Config file (relative to input)
- "configFile": "book.json",
+ "configFile": "book",
// Output generator
"generator": "site",
@@ -93,17 +93,11 @@ var generate = 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', 'defaultsPlugins');
-
- _.extend(options, _config);
- }, function() {
- // No config file: not a big deal
- return Q();
- });
+ var _config = require(path.resolve(options.input, options.configFile));
+
+ _.extend(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins'));
+
+ return Q();
})
// Read readme