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

UTF-8 required for automatic reloading

Open akirataguchi115 opened this issue 1 year ago • 2 comments

Describe the bug I had to add <head><meta charset="UTF-8"></head> for the five-server to start automatically reloading. Courtesy of: https://stackoverflow.com/questions/70249584/live-server-not-refreshing-browser . What's the explanation to this? Not sure if it is a bug but it is not self-explanatory either.

akirataguchi115 avatar Jul 22 '24 11:07 akirataguchi115

Five Server needs to inject some code into the head. But I believe you only need a minimum of an empty html, body and head tag for it to work. So no meta+utf8.

See https://github.com/yandeu/five-server/blob/main/src/middleware/injectCode.ts


Doesn't it work with just the code below?

<!DOCTYPE html>
<html>
  <head></head>
  <body></body>
</html>

yandeu avatar Jul 26 '24 10:07 yandeu

You're right the meta+utf8 was indeed not the problem here. It seems that someone has addressed the injecting "issue" back in 2016: https://stackoverflow.com/a/25749523/7629743

A simple example

<!doctype html>
<head></head>

autoreloads fine but I'm not using the head (nor html or body) element at all in this case.

Justifying this with The Google Style Guide for HTML would be pure insanity from my side but on my case five-server just doesn't work.

Should I leave this issue open for future ideas or should I close this as "not planned"?

akirataguchi115 avatar Jul 26 '24 11:07 akirataguchi115