grunt-contrib-watch
grunt-contrib-watch copied to clipboard
Watch for folder deletion
Need to watch if folder is removed.
Could you explain the issue you are having more?
I have a dev folder and tmp folder. Files from dev are copying to tmp, and deleted if deleted in dev. But I need to have a possibility to remove a whole folder too, with or without content. But for now watcher does not react for folder deletion anyway.
Which version of node and watch task are you using? and which OS and version are you on? Could you post your gruntfile as well? Thanks!
I still have this issue a few years along the line, removing a directory does not trigger a watch event.
My settings:
watch: {
"js": {
"files": ["static/es6/**"],
"tasks": ["babel:dist"],
"options": {
"interrupt": true,
"spawn": false
}
}
}
- Grunt
v0.4.5
- Watch
v0.6.1
- Node
v0.12.4
- OS X
v10.10.5
I'm also having this issue – specifically, folders that are in the "root" level (relative to the pattern) can be deleted without triggering watch, though sub-folders further down are watched OK.
My settings:
watch: {
images: {
files: ['src/img/**'],
tasks: ['clean:images','copy:images']
}
}
When "src/img/foo" is deleted, watch doesn't trigger. When "src/img/foo/bar" is deleted, watch triggers correctly.
- Grunt
v0.4.5
- Watch
v0.6.1
- Node
v5.5.0
- OS
v10.11.2
This issue still persists.
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
});
Code above will only log files/directories added, file changes, deletion of files, but not deletion of directories.
- Grunt
1.0.1
- Watch
1.0.0
- Node
7.5.0
- macOS
10.12.1