Output file missing JSON data
See original GitHub issueThis is a question/help, I wish I could label it that… I am trying process 1 handlebar template with 1 JSON file. The output file, does not show any of the data from the JSON file. What am I doing wrong?
gulp task:
gulp.task('handlebarsProcess2', function () {
return gulp
.src('src/templates/Dreamscape.handlebars')
.pipe(hb({
data: 'src/data/dreamscape_data.json'
}))
.pipe(concat('templates-processed2.html'))
.pipe(gulp.dest('build'));
});
Template before:
<div id="Dreamscape{{id}}" class="hello">
{{#projs}}
<div id="itemNumber{{id}}" tabindex="0" class="porthole {{addClass}}" style="background:{{bkgd}}">{{id}}</div>
{{/projs}}
</div>
Template processed/output file:
<div id="Dreamscape" class="hello">
</div>
JSON file:
{
"id":"myIDHere",
"projs": [
{
"id": "home",
"addClass": "Home"
},
{
"id": "sec1",
"addClass": "One"
}
]
}
Thanks for the help.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Missing JSON option at Data > New query > From File
There is an easy workaround. Go to Data Tab on Ribbon and follow these steps: 1 ...
Read more >JSON data missing while sending to server - Stack Overflow
try using the following con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");. Example
Read more >JSON output has some data missing · Issue #280 - GitHub
I am using the demo http://oss.sheetjs.com/js-xlsx with attached file. The CSV output looks right, but JSON output has only data for first column...
Read more >Data Processor not returning any data for valid JSON
303179~1595518588~~InputFromBuffer%Missing a colon after a name of object ... web consumer transformation (Output XML) to a Data processor transformation.
Read more >Resolve JSON errors in Amazon Athena - AWS
Resolution · Use the correct JSON SerDe · Use one line per record · Use the correct data type in each column ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version 2.0 of
gulp-hb
introduced a breaking change for the data attribute. It’s now usingrequire-glob
to pull in data which takes filenames into account. Try updating your template to include the filename (without the extension) of your data, like so:Or wrap it in a {{#with}} block:
gulp-hb
is agulp
wrapper aroundhandlebars-wax
which has a section on registering data. I think it would be better to update the documentation in that README and leave this one pretty generic. Feel free to open an issue or PR over there. Thanks!