我有包含此内容的src/data/mydata.json文件(从getting json data into assemble templates in grunt复制)
{
"name": "This is a square widget",
"modifier": "widget-square"
}当我尝试在somepage.hbs中使用它时,我什么也得不到
<div class="col-md-5">
{{mydata.name}}
</div>为什么?
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' ]);
};发布于 2016-01-05 09:03:18
这只是我的Gruntfile中的一个错误类型,dara而不是data。
https://stackoverflow.com/questions/34606514
复制相似问题