哈文一直在玩这个玩几个小时 的package.json { "name": "compile-tests", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" exit 1" }, "author": "", "license": "ISC",
的package.json
{
"name": "compile-tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"assemble": "^0.7.3"
}
}
Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assemble: {
options: {
flatten: true,
layout: "../templates/1.hbs"
},
pages: {
files: {
'../dist' : ['../pages/*.hbs']
}
}
}
});
grunt.loadNpmTasks('assemble');
grunt.registerTask('default', ['assemble']);
};
尝试删除并重新安装所有模块几次.并尝试了不同的版本,有趣的是,这篇文章http://blog.parkji.co.uk/2013/07/06/building-a-static-site-using-grunt-and-assemble.html中提到的版本似乎可以工作,但后来我得到了其他问题,因为那些版本已经过时了.
错误
$Grunt >> Local Npm module "assemble" not found. Is it installed? Warning: Task "assemble" not found. Used --force, continuing.我只需要使用grunt-assemble
$npm install grunt-assemble --save-dev
并在Gruntfile.js中调整此行
grunt.loadNpmTasks('grunt-assemble');
