Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 765cc5a

Browse files
Merge pull request #9 from pattern-lab/config-in-engines
Add support for load-time config injection
2 parents f301034 + e9f2eed commit 765cc5a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/engine_mustache.js

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
var Mustache = require('mustache');
2323
var utilMustache = require('./util_mustache');
2424

25+
// This holds the config from from core. The core has to call
26+
// usePatternLabConfig() at load time for this to be populated, which
27+
// it does, so we're cool, right?
28+
let patternLabConfig = {};
29+
2530
var engine_mustache = {
2631
engine: Mustache,
2732
engineName: 'mustache',
@@ -111,6 +116,16 @@ var engine_mustache = {
111116
foundPatternPartial = foundPatternPartial.split(':')[0];
112117

113118
return foundPatternPartial;
119+
},
120+
121+
/**
122+
* Accept a Pattern Lab config object from the core and put it in
123+
* this module's closure scope so we can configure engine behavior.
124+
*
125+
* @param {object} config - the global config object from core
126+
*/
127+
usePatternLabConfig: function (config) {
128+
patternLabConfig = config;
114129
}
115130
};
116131

0 commit comments

Comments
 (0)