Open elik-ru opened 1 year ago
@elik-ru thanks for the PR 🙌 I will review and test on the weekend
Nice PR. Tested at my end, the only thing that didnt work out was the default :css
mode, my setup is jsbundling + cssbundling + talwindcss.
It fails silently here because my stylesheet tag do not contain a stylesheet data attribute, as your code is expecting. My link is:
<link rel="stylesheet" href="/assets/application-{{big-hash-here}}.css" data-turbo-track="reload">
I could fix it adding the data attribute manually, like this:
# application.html.erb
<%= stylesheet_link_tag "application", "data-turbo-track": "reload", "data-stylesheet": "application.css" %>
Is this expected?
@LEstradioto Thanks for your feedback! Yes, this is kinda expected, because actual filename differs form digested url, and digested url changes when file changes, there is no easy way to match actual filename and corresponding Githubissues.
This PR introduce 2 major changes:
Reload modes: Depending on what changed we can do different reload types.
Auto-reload on error pages: I have added a middleware which injects livereload code into error pages.
To be honest, i did this couple of month ago and did not have time to submit a PR, and now looking at the code it looks like an alien wrote it. But if you think i need to improve something in this PR, i'll try to do this.