Gruntjs Grunt监视未运行辅助任务
我是grunt新手,正在尝试配置gruntfile以监视更改并运行适当的编译器(compass、jst和jshint,目前适用) Compass、JST和JsHint都可以独立工作,但当我试图从watch调用它们时,它们不会激活。GrunFile检测到更改,但不执行任何操作Gruntjs Grunt监视未运行辅助任务,gruntjs,watch,Gruntjs,Watch,我是grunt新手,正在尝试配置gruntfile以监视更改并运行适当的编译器(compass、jst和jshint,目前适用) Compass、JST和JsHint都可以独立工作,但当我试图从watch调用它们时,它们不会激活。GrunFile检测到更改,但不执行任何操作 module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'),
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dev: {
files: {
"stylesheets/global.css": "sass/*.scss"
}
}
},
jst: {
compile: {
files: {
"javascript/compiled/templates.js": ["templates/*.html"]
}
}
},
jshint: {
files: ['gruntfile.js', 'javascript/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
css: {
files: 'sass/*.scss',
task: ['compass']
},
templates: {
files: 'templates/*.html',
task: ['jst']
},
scripts: {
files: ['javascript/**/*.js', 'gruntfile.js'],
task: ['jshint']
},
options: {
spawn: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jst', 'compass', 'watch']);
};
我做错了什么?我已经在所有gem及其依赖项上运行了gem安装。
任务
在watch config中是复数形式。将手表配置中的task:['compass']
更改为tasks:['compass']
tasks
。将task:['compass']
更改为tasks:['compass']
叹气,我因为这个打字错误才损失了两个小时叹气,我因为这个打字错误才损失了两个小时