diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-04-02 09:38:57 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-04-02 09:38:57 +0200 |
commit | 82a58e7ac3c78bd30a3528956490d325b6424523 (patch) | |
tree | 7ada09c40280cdda8f06276c721074e6794a1e1c /lib/configuration.js | |
parent | dcb56ef433147a5aca9b662fe0a3b82dee3a7382 (diff) | |
download | gitbook-82a58e7ac3c78bd30a3528956490d325b6424523.zip gitbook-82a58e7ac3c78bd30a3528956490d325b6424523.tar.gz gitbook-82a58e7ac3c78bd30a3528956490d325b6424523.tar.bz2 |
Invalidate configuration cache when reloading
Diffstat (limited to 'lib/configuration.js')
-rw-r--r-- | lib/configuration.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/configuration.js b/lib/configuration.js index 3f8c822..a26135c 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -96,8 +96,17 @@ Configuration.prototype.load = function() { return Q() .then(function() { + var configPath, config; + + configPath = require.resolve( + path.resolve(that.book.root, that.options.configFile) + ); + + // Invalidate node.js cache for livreloading + delete require.cache[configPath]; + try { - var _config = require(path.resolve(that.book.root, that.options.configFile)); + _config = require(configPath); that.options = _.merge( that.options, _.omit(_config, 'configFile', 'defaultsPlugins', 'generator', 'extension') |