https://htmx.org logo
I understand you <@725789255590215732>. This is no...
# htmx-general
s
I understand you @mysterious-toddler-20573. This is no longer a trivial task and will have its limits. It will not be possible to capture all situations perfectly. But I can imagine it as real. The newly discovered and tags (in loaded HTML by Ajax requests) for external styles could be inserted into the HTML before adding/replacing the HTML from the Ajax request. So, after replacing HTML, the content will be styled straight away and will not flicker. Scripts (both inline and external via the src attribute) would in turn be inserted in some clever way at the end of the HTML. Of course, in order to prevent the same JavaScript from being inserted and executed repeatedly, it would be possible to use some data attribute in the tag to set whether this javascript should be inserted and therefore interpreted again, even if it has already been inserted once before. To avoid solving this problem, Unpoly guides people to use
up.compiler()
(https://unpoly.com/up.compiler), which is quite an elegant way, but it also has certain limits for large projects, especially due to the impossibility of using lazy-loading techniques effectively. If we were not concerned with performance, of course we would load all the styles and JavaScripts for the entire website/application directly on the homepage, but this is not a suitable way.