Skip to content

Commit 64dd237

Browse files
author
Brian Muenzenmeyer
committed
Merge pull request #338 from pattern-lab/332-move-meta
moved head and foot management code
2 parents 985c466 + 8d62ca3 commit 64dd237

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

core/lib/patternlab.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,21 @@ var patternlab_engine = function (config) {
181181

182182
//set user defined head and foot if they exist
183183
try {
184-
patternlab.userHead = pattern_assembler.findPartial('atoms-_00-head', patternlab);
185-
patternlab.userHead.extendedTemplate = patternlab.userHead.template;
184+
patternlab.userHead = fs.readFileSync(path.resolve(paths.source.root, '_meta', '_00-head.mustache'), 'utf8');
186185
}
187186
catch (ex) {
188187
if (patternlab.config.debug) {
189188
console.log(ex);
190-
console.log('Could not find optional user-defined header, atoms-head pattern. It was likely deleted.');
189+
console.log('Could not find optional user-defined header, usually found at ./source/_meta/_001-head.mustache. It was likely deleted.');
191190
}
192191
}
193192
try {
194-
patternlab.userFoot = pattern_assembler.findPartial('atoms-_01-foot', patternlab);
195-
patternlab.userFoot.extendedTemplate = patternlab.userFoot.template;
193+
patternlab.userFoot = fs.readFileSync(path.resolve(paths.source.root, '_meta', '_01-foot.mustache'), 'utf8');
196194
}
197195
catch (ex) {
198196
if (patternlab.config.debug) {
199197
console.log(ex);
200-
console.log('Could not find optional user-defined footer, atoms-foot pattern. It was likely deleted.');
198+
console.log('Could not find optional user-defined footer, usually found at ./source/_meta/_01-foot.mustache. It was likely deleted.');
201199
}
202200
}
203201

@@ -216,7 +214,7 @@ var patternlab_engine = function (config) {
216214
//set pattern-specific header if necessary
217215
var head;
218216
if (patternlab.userHead) {
219-
head = patternlab.userHead.extendedTemplate.replace('{% pattern-lab-head %}', patternlab.header);
217+
head = patternlab.userHead.replace('{% pattern-lab-head %}', patternlab.header);
220218
} else {
221219
head = patternlab.header;
222220
}
@@ -247,7 +245,8 @@ var patternlab_engine = function (config) {
247245
console.log(err);
248246
}
249247
allData = plutils.mergeData(allData, pattern.jsonFileData);
250-
var headHTML = pattern_assembler.renderPattern(patternlab.userHead, allData);
248+
//var headHTML = pattern_assembler.renderPattern(patternlab.userHead, allData);
249+
var headHTML = pattern_assembler.renderPattern(pattern.header, allData);
251250

252251
//render the extendedTemplate with all data
253252
pattern.patternPartialCode = pattern_assembler.renderPattern(pattern, allData);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"handlebars": "^4.0.5",
1111
"html-entities": "^1.2.0",
1212
"json5": "^0.5.0",
13-
"lodash": "^4.12.0",
13+
"lodash": "~4.13.0",
1414
"markdown-it": "^6.0.1",
1515
"mustache": "^2.2.0",
1616
"twig": "^0.9.5",

0 commit comments

Comments
 (0)