phoenixframework / phoenix_live_reload

Provides live-reload functionality for Phoenix
MIT License
315 stars 90 forks source link

Live reload injected in wrong `body` #119

Closed steveops closed 2 years ago

steveops commented 2 years ago

Hello, I have a web app that uses vue js. In one of the templates, I pass data to a vue js instance as below;

<my-vue-component :html-data="<%= @html_string %>"></my-vue-component>

If the assign @html_string happens to contain both <body> and </body> substrings, the live reload script will be injected there and not in front of the intended </body> tag. Thats according to lib/phoenix_live_reload/live_reloader.ex:125 shown below

Screenshot 2021-11-17 at 14 54 45

This is causing trouble for some of my js scripts. Any way to remedy it?

steveops commented 2 years ago

Thank you @josevalim!