After few hours of digging into problem i gave up and want some advice. Here`s the case:
When i change any '.js' file in watched directory, watch task is firing lots of events on ALL '.js' files in that directory.
Something like:
File "path:/to/valid/directory/CHANGED_FILE.JS" added File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" DELETED File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" DELETED
----------- ALL FILES IN DIR DELETED -----
File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" DELETED File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" RENAMED
File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" ADDED File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" ADDED
----------- ALL FILES IN DIR ADDED-----
File "ANOTHER_FILE_IN_SAME_DIRECTORY.JS" ADDED
As you can see, the changed file is marked as "added". Then ALL THE REST OF FILES in same directory are marked as deleted. For some reason ONE FILE(every time same one, but not the changed file) is marked as RENAMED. Then all files in directory(but not changed) are marked as "added".
Any help/advice ? No idea where to look. Tried to play with options, nothing. When i set the files property to point to specific file and not using blob(*.js or **/* stuff) - all works fine.
P.S. Important note, watch task works fine, but these events are polluting my console and i suspect all these events affect performance.
Answers like "if everything works, why bother ?" are not acceptable. Thx.
I have a standard Gruntfile.js
module.exports = function (grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
watch: {
options: {
livereload: false
},
default: {
files: ['path:/to/valid/directory/*.js'],
tasks: [],
options: {
spawn: false,
event: ['all']`enter code here
}
}
}
});
grunt.registerTask('default', [
'watch:default'
]);
};
via Alex Frolov
No comments:
Post a Comment