I have src/data/mydata.json
file with this content (copied from getting json data into assemble templates in grunt)
{
"name": "This is a square widget",
"modifier": "widget-square"
}
When I try to use it in somepage.hbs
I get nothing
<div class="col-md-5">
{{mydata.name}}
</div>
Why?
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
assemble: {
options: {
assets: "dist/assets",
dara: "src/data/*.json",
layoutdir: "src/layouts/",
flatten: true
},
pages: {
options: {
layout: "page.hbs"
},
files: {
"dist/": ["src/*.hbs", "!src/index.hbs" ]
}
},
homepage: {
options: {
layout: "homepage.hbs"
},
files: {
"dist/": ["src/index.hbs" ]
}
}
},
copy: {
assets: {
files: [
{ expand: true, cwd: "src/assets/", src: ["**"], dest: "dist/assets/" }
]
}
},
watch: {
scripts: {
files: 'src/**',
tasks: ['assemble', 'copy'],
options: {
}
}
}
});
grunt.loadNpmTasks('grunt-assemble' );
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['assemble', 'copy' ]);
};
It was just a mistype in my Gruntfile
, dara instead of data. Looks like it works fine after fixing it.