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

live-server should inject body tags as necessary #165

Closed
niedzielski opened this issue Dec 23, 2016 · 3 comments
Closed

live-server should inject body tags as necessary #165

niedzielski opened this issue Dec 23, 2016 · 3 comments

Comments

@niedzielski
Copy link

live-server v1.1.0

I'm using the Phaser JavaScript game framework which requires a static HTML page like:

<html>

  <head>
    <title>hello world!</title>
    <!-- phaser scripts -->
  </head>

  <!-- body automatically injected by phaser -->

</html>

Unfortunately, live-server fails to detect any file change and refresh when body tags are not present as in the above example. Replacing the comment with <body></body> allows live-server to function properly.

@pmd3d
Copy link

pmd3d commented Dec 26, 2016

hi. I encountered a similar problem. I'm not experienced with pull requests but attempted to make one. Please let me know if I missed anything, and I will try to correct it.

@tapio
Copy link
Owner

tapio commented Jan 9, 2017

Web pages making extensive use of ajax might be fetching html fragments that are not full pages and we should not inject those as that would result in having the script multiple times on a single page. For this reason, live-server uses a simple heuristic to determine when to inject: if it finds a </body> tag. I merged @pmd1991's PR that falls back to injecting to </head> if body is not found, which should help in this particular case.

@tapio tapio closed this as completed Jan 9, 2017
@niedzielski
Copy link
Author

👍 @pmd1991 @tapio, thanks! Seems to work!

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

3 participants