summaryrefslogtreecommitdiffstats
path: root/lib/configuration.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/configuration.js')
-rw-r--r--lib/configuration.js46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/configuration.js b/lib/configuration.js
index 5c5f9af..86478c8 100644
--- a/lib/configuration.js
+++ b/lib/configuration.js
@@ -84,31 +84,8 @@ function normalizePluginsList(plugins, addDefaults) {
}
var Configuration = function(book, options) {
- var that = this;
-
this.book = book;
this.replace(options);
-
- // options.input == book.root
- Object.defineProperty(this.options, 'input', {
- get: function () {
- return that.book.root;
- }
- });
-
- // options.originalInput == book.parent.root
- Object.defineProperty(this.options, 'originalInput', {
- get: function () {
- return that.book.parent? that.book.parent.root : undefined;
- }
- });
-
- // options.originalOutput == book.parent.options.output
- Object.defineProperty(this.options, 'originalOutput', {
- get: function () {
- return that.book.parent? that.book.parent.options.output : undefined;
- }
- });
};
// Read and parse the configuration
@@ -171,8 +148,31 @@ Configuration.prototype.extend = function(options) {
// Replace the whole configuration
Configuration.prototype.replace = function(options) {
+ var that = this;
+
this.options = _.cloneDeep(DEFAULT_CONFIG);
this.options = _.merge(this.options, options || {});
+
+ // options.input == book.root
+ Object.defineProperty(this.options, 'input', {
+ get: function () {
+ return that.book.root;
+ }
+ });
+
+ // options.originalInput == book.parent.root
+ Object.defineProperty(this.options, 'originalInput', {
+ get: function () {
+ return that.book.parent? that.book.parent.root : undefined;
+ }
+ });
+
+ // options.originalOutput == book.parent.options.output
+ Object.defineProperty(this.options, 'originalOutput', {
+ get: function () {
+ return that.book.parent? that.book.parent.options.output : undefined;
+ }
+ });
};
// Dump configuration as json object