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

Commit 7a6d9c6

Browse files
committed
pass unit test 'handlebars partials can render JSON values'; a mechanism
for passing the oPattern's jsonData by default was needed, apparently.
1 parent b933916 commit 7a6d9c6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

builder/object_factory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/*
2-
* patternlab-node - v1.0.0 - 2015
3-
*
1+
/*
2+
* patternlab-node - v1.0.0 - 2015
3+
*
44
* Brian Muenzenmeyer, and the web community.
55
* Licensed under the MIT license.
66
*
@@ -55,7 +55,7 @@
5555
if (config.debug && this.isPseudoPattern) {
5656
console.log('===', this.name + ' IS A PSEUDO-PATTERN ===');
5757
}
58-
return this.engine.renderPattern(this.extendedTemplate, data, partials);
58+
return this.engine.renderPattern(this.extendedTemplate, data || this.jsonFileData, partials);
5959
},
6060

6161
registerPartial: function () {

builder/pattern_assembler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@
101101

102102
//look for a json file for this template
103103
try {
104-
var jsonFilename = patternlab.config.patterns.source + currentPattern.subdir + '/' + currentPattern.fileName + ".json";
105-
currentPattern.jsonFileData = fs.readJSONSync(jsonFilename.substring(2));
104+
var jsonFilename = path.resolve(patternlab.config.patterns.source, currentPattern.subdir, currentPattern.fileName + ".json");
105+
currentPattern.jsonFileData = fs.readJSONSync(jsonFilename);
106106
if(patternlab.config.debug){
107107
console.log('processPatternIterative: found pattern-specific data.json for ' + currentPattern.key);
108108
}

0 commit comments

Comments
 (0)