live-server icon indicating copy to clipboard operation
live-server copied to clipboard

Document requirement for body tag

Open bibhas2 opened this issue 5 years ago • 2 comments

Before submitting an issue, please, see https://github.com/tapio/live-server#troubleshooting

Issue description

live-server requires that body tag be present in the HTML. This should be documented clearly. Granted most web pages will have body tag. Still it will be a good idea to document it.

Software details

  • Command line used for launching live-server: live-server
  • OS: Mac-OS
  • Browser (if browser related): Chrome
  • Node.js version: v11.5.0
  • live-server version: 1.2.1

bibhas2 avatar Feb 13 '20 14:02 bibhas2

I ran into this! I was lazy, had an index.html like

<!DOCTYPE html>

<p>Hello</p>

and so on, and live-reload mysteriously wasn't working.

In fact, rather than documenting the requirement (must have either body or head or svg), it would be nice if there's an error message printed.

Actually, when I run live-server --verbose such an error message is printed:

Failed to inject refresh script! Couldn't find any of the tags  [ /<\/body>/i, /<\/svg>/, /<\/head>/i ] from /path/to/bad.html

so it would be nice if this (important!) error message is printed even without --verbose.

shreevatsa avatar Sep 21 '20 23:09 shreevatsa

This PR might help: https://github.com/tapio/live-server/pull/217

gdw2 avatar Dec 11 '20 05:12 gdw2