-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
newer not working properly with watch #8
Conversation
To use var srcFiles = 'src/**/*.js';
grunt.initConfig({
jshint: {
all: {
src: srcFiles
}
},
watch: {
all: {
files: srcFiles,
tasks: ['newer:jshint:all']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-newer'); Above, the Is this similar to what you are trying to accomplish? |
We just ran into (may be another) problem with watch and newer. Our config looked something like:
So basically the same as yours, but without the use of an external variable, but use of the internal grunt templating system. Any hint on how to fix this? (For now, we might stick with the extra variable, but we’d like to avoid it.) |
@johnyb can you provide more detail on the issue that you're seeing with this config? I'm seeing the same behavior when I use a variable or the template syntax. And you can |
Ok, I've been able to reproduce this with a new task that composes the above tasks: grunt.registerTask('lint-then-watch', ['newer:jshint', 'watch']); To support template syntax for the files configuration in this case, the |
I’m very new to grunt (we just started porting a larger app this week), so I’m not quite sure what exactly is happening. Anyway, thanks for taking a look! :) |
This allows tasks to be created that compose newer-prefixed tasks with other tasks that might be configured with Grunt's template syntax to use the same config. For example a task called `lint-then-watch` might be registered that composes `newer:jshint` and `watch`. If the `watch` targets use template syntax to get the file config from the `jshint` targets, the `jshint` targets must be reconfigured after being run with a modified configuration.
Reconfigure modified targets after successful runs. This allows composed tasks to use template syntax for files config.
Released as |
Works like a charm, now :) 🙇 |
hello,
It seems that the first time newer runs from the watch, it calls grunt.config.set([name, [target], config). here config has the newer files. After that, in all repeat runs, grunt.config.get([name, target]) gets the above set config with only the newer files. Now, if I change any other files that affect this particular task, newer won't pick it up. Please let me know if you need me to send an example grunt config.
Thanks,
Nachiket