diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-10-29 17:19:19 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-10-29 17:19:19 +0100 |
commit | 591d8fc9eef2c6727c3d66bbe50b833893731532 (patch) | |
tree | 4f9fe9b2a52f0fe9863cd2c0060d954c275778a6 | |
parent | d480e9cea431fb4f6032b2048da48b178b0c3cd3 (diff) | |
download | gitbook-591d8fc9eef2c6727c3d66bbe50b833893731532.zip gitbook-591d8fc9eef2c6727c3d66bbe50b833893731532.tar.gz gitbook-591d8fc9eef2c6727c3d66bbe50b833893731532.tar.bz2 |
Use book.json to store variables
-rw-r--r-- | lib/generate/generator.js | 20 | ||||
-rw-r--r-- | lib/generate/site/index.js | 2 |
2 files changed, 2 insertions, 20 deletions
diff --git a/lib/generate/generator.js b/lib/generate/generator.js index 84c65d7..4791c98 100644 --- a/lib/generate/generator.js +++ b/lib/generate/generator.js @@ -14,9 +14,6 @@ var BaseGenerator = function(options) { this.options.plugins = Plugin.normalizeNames(this.options.plugins); this.options.plugins = _.union(this.options.plugins, this.options.defaultsPlugins); this.plugins = []; - - // Include variables (not yet loaded) - this.variables = {}; }; BaseGenerator.prototype.callHook = function(name, data) { @@ -25,22 +22,7 @@ BaseGenerator.prototype.callHook = function(name, data) { // Sets up generator BaseGenerator.prototype.load = function() { - return this.loadVariables() - .then(this.loadPlugins.bind(this)); -}; - -BaseGenerator.prototype.loadVariables = function() { - var that = this; - - return fs.readFile(path.join(this.options.input, 'variables.json'), 'utf8') - .then(function(content) { - try { - that.variables = JSON.parse(content); - } catch(err) { - console.log('No variables.json'); - } - }) - .fail(function() {}); + return this.loadPlugins(); }; BaseGenerator.prototype.loadPlugins = function() { diff --git a/lib/generate/site/index.js b/lib/generate/site/index.js index 4179917..6d86c7c 100644 --- a/lib/generate/site/index.js +++ b/lib/generate/site/index.js @@ -128,7 +128,7 @@ Generator.prototype.prepareFile = function(content, _input) { // Output directory outdir: path.dirname(_input) || '/', // Templating variables - variables: that.variables, + variables: that.options.variables, }); }) .then(function(sections) { |