firstandthird / load-grunt-config

Grunt plugin that lets you break up your Gruntfile config by task
firstandthird.github.io/load-grunt-config/
MIT License
374 stars 64 forks source link

Infinite loop when running 'watch' alias #47

Closed tigerclaw-az closed 10 years ago

tigerclaw-az commented 10 years ago

I was attempting to run 'grunt watch' after creating my watch.js configuration:

module.exports = {
    files: ['./index.html'],
    options: {
        livereload: true,
        port: 666
    },
    tasks: ['jshint']
};

and I was presented with a constant barrage of messages:

...
Running "watch" task
Waiting...Verifying property watch exists in config...ERROR
>> Unable to process task.
Warning: Required config property "watch" missing.

Running "watch" task
Waiting...Verifying property watch exists in config...ERROR
>> Unable to process task.
Warning: Required config property "watch" missing.

Running "watch" task
Waiting...Verifying property watch exists in config...ERROR
>> Unable to process task.
Warning: Required config property "watch" missing.
...

The only way I could exit was hitting Ctrl-C to kill the process.

FrankFang commented 10 years ago

You didnot specify a target. My config:

module.exports = {
    jshint: {
        files: [
            '<%= grunt.config.app %>/static/**/*.js',
            '!<%= grunt.config.app %>/static/bower_components/**/*.js'
        ],
        tasks: ['jshint', 'notify:jshint']
    }
}
tigerclaw-az commented 10 years ago

@FrankFang my jshint configuration is defined in the"jshint.js" file under my grunt/ folder.

FrankFang commented 10 years ago

@ejwaibel It's the same with me. But how about modify your jshint.js into this:

module.exports = {
    whateverName:{
        files: ['./index.html'],
        options: {
            livereload: true,
            port: 666
        },
        tasks: ['jshint']
    }
};
tigerclaw-az commented 10 years ago

@FrankFang Do you mean modify my watch.js file? Does the load-grunt-config not set default tasks like the current initConfig() does?

e.g. If I set the following:

.... watch: { .... } ....

in the grunt.initConfig(), then grunt automatically adds a registerTask for 'watch', so that I can do this: grunt watch without having to set grunt.registerTask('watch', ['watch'])

jgallen23 commented 10 years ago

I set up a dummy repo to test this and I cannot reproduce: https://github.com/firstandthird/load-grunt-config-tests

Can you take a look to see if you have anything different in your setup? I'm running grunt watch and it runs fine

tigerclaw-az commented 10 years ago

@jgallen23 This problem might be caused by issue #46 , I will try testing some more and see what further information I can supply.

tigerclaw-az commented 10 years ago

Ok, the issue comes into play when I try to use variables from another grunt file, try setting this in watch.js:

files = ['<%= csslint.files =>', '<%= jshint.files =>']

then set your files in jshint.js to this:

files = ['/js/**/*.js']

tigerclaw-az commented 10 years ago

LOL! Ignore this, I guess it would help if I actually load the files for csslint! All is well with the world :)