My Json data doesn´t get parsed. Assemble v0.17.1, Gulp v3.9.1
I have this task in my Gulpfile.js:
var app = assemble();
app.helpers(helpers());
gulp.task('load', function(cb) {
app.layouts(pathDir.layouts + '/*.hbs');
app.pages(pathDir.pages + '/**/*.hbs');
app.partials(pathDir.partials + '/**/*.hbs');
app.data(pathDir.data + '/*.json');
cb();
});
gulp.task('assemble', ['load'], function() {
return app.toStream('pages')
.pipe(plumber())
.pipe(app.renderFile())
.pipe(extname())
.pipe(app.dest(pathDir.dev));
});
my test.json file looks like this:
{"title": "Das ist ein Test"}
My testpage.hbs looks like this:
<div style="font-size:32px;">AAAA
<span style="background-color:#f00;">{{test.title}}</span>
BBB
</div>
In my rendered html i only get:
<div style="font-size:32px;">AAAA<span style="background-color:#f00;"></span>BBB</div>
What am I doing wrong?
Try passing the
namespace
option to theapp.data
method:It was mentioned in the changelog section that the
.data
method is using base-data, but the api section hasn't been updated yet. The namespacing option is described here.