tapio / live-server

A simple development http server with live reload capability.
http://tapiov.net/live-server/
4.41k stars 484 forks source link

Document requirement for body tag #341

Open bibhas2 opened 4 years ago

bibhas2 commented 4 years ago
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

shreevatsa commented 3 years ago

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.

gdw2 commented 3 years ago

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