Gruntjs Grunt手表-验证属性

Gruntjs Grunt手表-验证属性,gruntjs,watch,Gruntjs,Watch,我正在尝试分离我的grunt文件,这样我就可以处理两个独立的代码块,除了watch任务之外,一切似乎都正常工作 我得到以下错误,该错误循环出现,直到超出调用堆栈 Waiting...Verifying property watch.app.files exists in config...ERROR >> Unable to process task. Warning: Required config property "watch.app.files" missing. 看来我不

我正在尝试分离我的grunt文件,这样我就可以处理两个独立的代码块,除了watch任务之外,一切似乎都正常工作

我得到以下错误,该错误循环出现,直到超出调用堆栈

Waiting...Verifying property watch.app.files exists in config...ERROR
>> Unable to process task.
Warning: Required config property "watch.app.files" missing.
看来我不喜欢把我的手表任务一分为二。我环顾四周,这似乎不是其他人的问题

我的Grunfile看起来像这样:

module.exports = function(grunt) {

    // 1. All configuration goes here
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        concat: {
            app: {
                src: [
                    'themes/site_themes/app/scripts/build/libs/!(html5shiv|respond).js',
                    'themes/site_themes/app/scripts/build/modules/*.js'
                ],
                dest: 'themes/site_themes/app/scripts/production/app.min.js'
            },
            marketing: {
                src: [
                    'themes/site_themes/marketing/scripts/build/libs/!(html5shiv|respond).js',
                    'themes/site_themes/marketing/scripts/build/modules/*.js'
                ],
                dest: 'themes/site_themes/marketing/scripts/production/app.min.js'
            }
        },
        uglify: {
            app: {
                files: {
                    'themes/site_themes/app/scripts/production/app.min.js': ['themes/site_themes/app/scripts/production/app.min.js'],
                    'themes/site_themes/app/scripts/production/html5shiv.min.js': ['themes/site_themes/app/scripts/build/libs/html5shiv.js'],
                    'themes/site_themes/app/scripts/production/respond.min.js': ['themes/site_themes/app/scripts/build/libs/respond.js'],
                }
            },
            marketing: {
                files: {
                    'themes/site_themes/marketing/scripts/production/app.min.js': ['themes/site_themes/marketing/scripts/production/app.min.js'],
                    'themes/site_themes/marketing/scripts/production/html5shiv.min.js': ['themes/site_themes/marketing/scripts/build/libs/html5shiv.js'],
                    'themes/site_themes/marketing/scripts/production/respond.min.js': ['themes/site_themes/marketing/scripts/build/libs/respond.js'],
                }
            }
        },
        jshint: {
            app: {
                all: ['themes/site_themes/app/scripts/build/modules/!(analytics).js', 'themes/site_themes/app/scripts/build/app.js'],
            },
            marketing: {
                all: ['themes/site_themes/marketing/scripts/build/modules/!(analytics).js', 'themes/site_themes/marketing/scripts/build/app.js'],
            }
        },
        sass: {
            app: {
                options: {
                    style: 'compressed'
                },
                files: {
                    'themes/site_themes/app/styles/production/style.min.css':'themes/site_themes/app/styles/build/style.scss'
                }
            },
            marketing: {
                options: {
                    style: 'compressed'
                },
                files: {
                    'themes/site_themes/marketing/styles/production/style.min.css':'themes/site_themes/marketing/styles/build/style.scss'
                }
            }
        },
        autoprefixer: {
            options: {
                browsers: ['last 2 versions', 'ie >= 8']
            },
            app: {
                no_dest: {
                    src: 'themes/site_themes/app/styles/production/style.min.css',
                }
            },
            marketing: {
                no_dest: {
                    src: 'themes/site_themes/marketing/styles/production/style.min.css',
                }
            }
        },
        watch: {
            app: {
                jshint: {
                    files: ['themes/site_themes/app/scripts/build/modules/!(analytics).js', 'themes/site_themes/app/scripts/build/app.js'],
                    tasks: 'jshint:app'
                },
                scripts: {
                    files: ['themes/site_themes/app/scripts/build/*/*.js'],
                    tasks: ['concat:app', 'uglify:app'],
                    options: {
                        spawn: false,
                    },
                },
                css: {
                    files: ['themes/site_themes/app/styles/build/*.scss', 'themes/site_themes/app/styles/build/inuit/*/*.scss', 'themes/site_themes/app/styles/build/theme/*/*.scss'],
                    tasks: ['sass:app', 'autoprefixer:app'],
                    options: {
                        livereload: true,
                        spawn: false,
                    }
                }
            },
            marketing: {
                jshint: {
                    files: ['themes/site_themes/marketing/scripts/build/modules/!(analytics).js', 'themes/site_themes/marketing/scripts/build/app.js'],
                    tasks: 'jshint:marketing'
                },
                scripts: {
                    files: ['themes/site_themes/marketing/scripts/build/*/*.js'],
                    tasks: ['concat:marketing', 'uglify:marketing'],
                    options: {
                        spawn: false,
                    },
                },
                css: {
                    files: ['themes/site_themes/marketing/styles/build/*.scss', 'themes/site_themes/marketing/styles/build/inuit/*/*.scss', 'themes/site_themes/marketing/styles/build/theme/*/*.scss'],
                    tasks: ['sass:marketing', 'autoprefixer:marketing'],
                    options: {
                        livereload: true,
                        spawn: false,
                    }
                }
            }
        }


    });

    // 3. Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('default', ['concat:app', 'uglify:app', 'jshint:app', 'sass:app', 'autoprefixer:app', 'watch:app']);
    grunt.registerTask('marketing', ['concat:marketing', 'uglify:marketing', 'jshint:marketing', 'sass:marketing', 'autoprefixer:marketing', 'watch:marketing']);

};
刚找到。看起来监视不支持嵌套目标

我会尝试找到另一种方法来实现这一点,并张贴如果我这样做