-
Notifications
You must be signed in to change notification settings - Fork 357
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
New subfolders aren't watched until watch task is restarted #70
Comments
OSX 10.8.2, Node 0.8.21, Grunt 0.4.1, Grunt-CLI 0.1.6 |
This is a known issue shama/gaze#14. I have a fix in the works but I was cowardly waiting for this module to make a better fix. It was just released today \o/ so it's on my radar will get fixed in gaze soon. and checkout |
+1 for this - reeeeealy need it for next version of uRequire / grunt-urequire, the Javascript module converter. Tried with version 0.4.3 |
Until grunt-contrib-watch got fix you can use https://github.com/Steida/grunt-este-watch. |
@steida Rather than shamelessly advertising your own module on this issue tracker why don't you help the Grunt community and submit a fix for this issue? I took a quick glance at your task. It doesn't have any unit tests and is completely ignoring the Grunt API. I don't see how that is a solution to this issue. |
Sorry for shameless advertising. ad unit tests ad completely ignoring the Grunt API ad I don't see how that is a solution to this issue. ad ... why don't you help the Grunt community and submit a fix for this issue? |
I am still having this problem today.
When I install new modules with npm, nothing happens. If I restart OSX 10.8.4 |
+1 |
This is a frustrating problem. Why is this issue closed? It's not working. |
I'm using grunt-contrib-watch 0.6.1 on Windows 7x64. I'm not having problems with my js files triggering it, but I am with html files. The grunt task in question is something like the following... watch: { It's actually quite a bit more complicated. If I can get the time, I will try to reproduce with a smaller sample. |
I ran a couple simple scenarios. If I create a "new.tpl.html" in an existing folder (one existing at the time grunt watch was run), everything works great. I see a "File "src\app\home\new.tpl.html" added", and my html2js task gets fired off. If I create a new folder, let's say "stuff", I see a "File 'src\app\stuff' added", and my jshint:src task is run, followed by karma:unit:run, copy:build_appjs, jshint:test, and finally karma:unit:run. This is the sequence associated with my watching of the following - files: [ 'src//*.js', '!src//.spec.js', '!src/assets/__/.js' ]. Not sure why it gets kicked off on a folder creation. If I then create a "new.tpl.html" in the stuff folder, I see "File 'src\app\stuff' deleted". What? The jshint:src task is run, followed by karma:unit:run, copy:build_appjs, jshint:test, and finally karma:unit:run (same sequence as above). Again, what? Why is that sequence being run? It's a sequence monitoring js files. If I create a "new.js" file in the stuff folder, I get the same "File 'src\app\stuff' deleted", followed by the exact same sequence, which is great this time around because I just added a js file. After this, trying to create more js and tpl.html files in the stuff folder produces no response whatsoever. grunt watch is still running, but it doesn't budge when I create more files in that folder. I can go back and create a file in a pre-existing folder though and it does what it's supposed to. I try the same thing with a "stuff2" folder. I see a File "src\app\stuff2" added. Same task sequence gets fired off I add a "new.js", first and this time I see "File "src\app\stuff2" deleted" followed immediately by "File "src\app\stuff2\new.js" renamed". That's new. Same task sequence is run. I accidentally shut this session down at this point and have to start a new one. I create a stuff3 folder, seeing "File 'src\app\stuff3' added", and the same sequence as above gets executed. I create a new.js file, same results as above. "File "src\app\stuff3" deleted" followed immediately by "File "src\app\stuff3\new.js" renamed". Same task sequence is run. I add a "new.tpl.html" file and see "File "src\app\stuff3" deleted", then same sequence as above executed (not what's supposed to be executed). I add a "new2.js" and I see "File "src\app\stuff3\new2.js" added" (correct message this time), followed by correct task sequence (same as above). I add a "new2.tpl.html" and get no response at all, but I can add a new3.js, and new4.js and have it work perfectly, telling me I added new js files and executing the appropriate sequence. Adding anything ending in html continues to produce no response. Very odd. |
@thardy If you can write a test that demonstrates the issue I'd be happy to look into a fix. I am unfortunately not able to reproduce any of the issues you're describing here, sorry. Even an example repo that demonstrates the issues would be helpful as well. Thanks! |
If you have the time, you can take a look at https://github.com/thardy/generator-ngbp. After installing the yeoman generator, you can "yo ngbp" and reproduce easily. Unfortunately, the gruntfile is anything but a simple example. If I get time, I will try to pair it down to a sample that demonstrates the core issue as well. |
This issue seems to exist on grunt-contrib-watch 0.6.1, works well with grunt-contrib-watch 0.5.3 |
Just tried switching to 0.5.3 and I still get the issue. |
@thardy I was using https://github.com/thardy/generator-ngbp, I was able to fix the bug by adding the 'index:build' task on the tasks of delta:jsrrc. jssrc: { I'll go send you a merge request. |
@dinevillar Your solution worked for me. Thank you! |
This issue still exists. Can be reproduced if 'events' in options are set to added,deleted.
If uncomment 'event' option, watcher would not watch newly created directories. |
Hmm, seems to me it's not so simple. Only once i accidentally make watcher watch newly created directories. But for now it doesn't. First guess was increment Fedora fs.inotify.max_user_watches = 524288 but this does not help. Keep searching... |
i also searching a solution for that: https://stackoverflow.com/questions/67507560/watch-folder-is-added-using-node |
If you watch a directory like so:
The task will do nothing if you add a new folder, then add a new file inside of it:
assets/test/
assets/test/test_file.css
If you restart the task, you'll be able to track the changes to files within that folder (but if you create any new folders, they will still be ignored until starting it again).
The text was updated successfully, but these errors were encountered: