Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gruntjs Grunt监视未运行辅助任务_Gruntjs_Watch - Fatal编程技术网

Gruntjs Grunt监视未运行辅助任务

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'),

我是grunt新手,正在尝试配置gruntfile以监视更改并运行适当的编译器(compass、jst和jshint,目前适用)

Compass、JST和JsHint都可以独立工作,但当我试图从watch调用它们时,它们不会激活。GrunFile检测到更改,但不执行任何操作

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']

叹气,我因为这个打字错误才损失了两个小时叹气,我因为这个打字错误才损失了两个小时