I'm having trouble compiling specific JSON data into my Handlebars template. So here is my data (./paperpages.json)
{
"a0": {
"paperCat": "a",
"paperName": "A0",
"sizex": "841",
"sizey": "1189"
},
"a1": {
"paperCat": "a",
"paperName": "A1",
"sizex": "594",
"sizey": "841"
},
"a2": {
"paperCat": "a",
"paperName": "A2",
"sizex": "420",
"sizey": "594"
}
}
I'm running a loop to go through each paper size, and generate a page with this paper's data on:
var paperpages = require('./paperpages.json');
for (var key in paperpages) {
var paperpage = paperpages[key];
gulp.src('templates/partials/layouts/base-paperpage.hbs')
.pipe(handlebars(paperpage))
.pipe(rename(fileName + ".php"))
.pipe(gulp.dest('pages/' + paperpage.paperCat));
}
However on each page, I'd like to list all the other papersizes, for example on a4.php, i'd like to list the dimensions for a0, a1, a2, a3 etc at the bottom of the page. My problem is that the data (var paperpage) being brought through into the template via the loop doesn't have access to the other papersizes in the object, so I can't loop through and print these onto the page. Are there any ideas on how I could go about doing this? I hope this makes sense, any help would be appreciated!