blaise-io / live-reload

Browser extension for web devs. Monitors source files on a page and reloads page or source file when a change is detected.
MIT License
60 stars 9 forks source link

Live reload with URL ending with ".html#/" (reveal.js presentation) #4

Closed maxigaz closed 6 years ago

maxigaz commented 6 years ago

I'm creating a presentation using Reveal.js. I use the option history so that when I reload the html file after a change, it doesn't jump back to the first slide but "remembers" where I was last time. This is achieved by automatically postfixing each slide's URL with #/n where n is a number. (The very first slide's postfix is simply #/) For example:

main.html#/ (1st slide)
main.html#/1 (2nd slide)
main.html#/2 (3rd slide)
main.html#/3 (4th slide)
…

The problem is that live reload doesn't work when this feature is active. When it's disabled and the URL is always set to main.html, it works perfectly.

I've also tried setting main.html* and main.#/ as the host file and a source, but it didn't work either.

I'm using the addon with Firefox 58.0.1 x64 for Linux and running a local Python server, as suggested in the addon description.

blaise-io commented 6 years ago

Match patterns should ignore the hash part of the URL, so you should leave them out of the host/source URL fields.

However, it seems like they're not being ignored or else your situation would work. I'll check this out this weekend.

blaise-io commented 6 years ago

@maxigaz I could not reproduce your issue.

It should work when your host URL is http://localhost:8000/main.html*. When a source file reloads it should maintain the hash in the URL when reloading the page. Can you try this host URL and tell me whether you see the counter badge on the toolbar icon with a value of 1 or higher?

If you're still running into issue, can I see your project somewhere online, or can you share it with me in a repository or zip file so I can help debug this issue?

maxigaz commented 6 years ago

I've just tried again now, and managed to make it work. I had to make sure both the host URL and source URL contain the line ending with main.html*.

Also, I'd like to mention that I couldn't set monitoring for only the html file if I change its name from main.html to index.html. In this case, I had to use http://localhost:8000/project* (where I have the files in the folder ~/project/) for both host and source URL, but then all the project files seems to be monitored.

I've uploaded a minimal example based on reveal.js you can use for testing here.

blaise-io commented 6 years ago

In case of index.html in the same parent folder as source files, you can create 2 separate reload rules:

maxigaz commented 6 years ago

It works! Thank you very much for the suggestions, as well as for making this addon.

blaise-io commented 6 years ago

👍 glad you like it

zanona commented 4 years ago

hey, @blaise-io, one thing I could reproduce is when having a file structure path like: http://localhost:8000/dist/style.css?ver=1.0.0 creating a rule with or without the query string won't trigger live reload. The only way I was able to get it working was by removing the query string from the html source.

blaise-io commented 4 years ago

Thanks @zanona, I will have a look into that.