Skip to content

Commit

Permalink
support config injection
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffp committed Feb 23, 2018
1 parent 8bb47bf commit d3600c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/patternengine-node-react/lib/engine_react.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const cheerio = require('cheerio');
const webpack = require('webpack');
const _require = require;

// This holds the config from from core. The core has to call
// usePatternLabConfig() at load time for this to be populated.
let patternLabConfig = {};

const outputTemplate = Hogan.compile(
fs.readFileSync(
path.join(__dirname, './outputTemplate.mustache'),
Expand Down Expand Up @@ -168,7 +172,19 @@ var engine_react = {
addOutputFiles(paths, patternlab) {

return [];
},


/**
* Accept a Pattern Lab config object from the core and put it in
* this module's closure scope so we can configure engine behavior.
*
* @param {object} config - the global config object from core
*/
usePatternLabConfig: function (config) {
patternLabConfig = config;
}

};

module.exports = engine_react;

0 comments on commit d3600c8

Please sign in to comment.