Skip to content
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

Why is index.html ignored when I do not issue any ignore pattern and how to fix this? #235

Open
halloleo opened this issue Oct 25, 2020 · 2 comments

Comments

@halloleo
Copy link

I run a livereload server from this code:

from livereload import Server, shell
server = Server()
server.watch('build/**/*')
server.watch('build/*')
print(server.watcher._tasks)
server.serve(host='0.0.0.0', root='build', port=9000)

When I run this server and then change the stuff in my site directory build I get logging output like this:

$$$ python server.py                                                                                 
{'build/**/*': {'func': None, 'delay': None, 'ignore': None, 'mtimes': {}}, 
 'build/*': {'func': None, 'delay': None, 'ignore': None, 'mtimes': {}}}
[I 201025 13:23:17 server:335] Serving on http://0.0.0.0:9000
[I 201025 13:23:17 handlers:62] Start watching changes
[I 201025 13:23:17 handlers:64] Start detecting changes
[I 201025 13:23:38 handlers:135] Browser Connected: http://localhost:9000/gallery/
[I 201025 13:24:36 handlers:95] Reload 1 waiters: build/static/css/custom.css
[I 201025 13:24:37 handlers:82] Ignore: build/index.html

The output shows in the last line that build/index.html is ignored hwich totally defets the propsuse - beacsue build/index.html was chanegd. And my debug print line at the top show clearly that in _tasks is no ignore attrivute set.

So why is build/index.html ignored and how can I tell livereload to watch all files in the directory build for changes. (The site is not very big; it contains only 114 files).

@pradyunsg
Copy link
Collaborator

if time.time() - cls._last_reload_time < reload_time:

As things currently stand, if you make changes "too quickly", they get ignored. I'm personally not 100% sure about how the logic here works, but I'll take a closer look sometime next month.

@halloleo
Copy link
Author

Thanks for the info, @pradyunsg.

Sounds like a bit of a straneg logic to me. - Maybe the system is designed to go through the whole motion of notifying the browser and reloading the content for each individual changed file?

Wouldn't it be better to collect all the changes and then do the reloading? Well, - easy for me to critise from the outside. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants