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

live reloading doesn't work without certain tags

Open towc opened this issue 4 years ago • 4 comments

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

Issue description

I was trying to use live-server on a barebones html file for quick prototyping, and didn't use any of the doctype/html/head/body boilerplate elements, as html5 automatically inserts them in the DOM if not present. After I added a <head>, live-reloading was working fine. I couldn't find this documented anywhere, and I only got it thanks to https://github.com/tapio/live-server/issues/242#issuecomment-375932248

I don't think this should be documented, but rather if it doesn't find a tag, it should just put the script at the top of the file, if the extension is html

Software details

  • Command line used for launching live-server:
  • OS: Linux
  • Browser (if browser related):
  • Node.js version: 10.5.0
  • live-server version: 1.2.1

towc avatar Dec 20 '19 09:12 towc

I'm taking a shot at making a pull request that should solve this issue. Currently, there's a pull request out there, #289, but it seems like it injects the <script> tag inside the last tag available instead of prepending or appending it to the document.

andria-dev avatar Jan 01 '20 04:01 andria-dev

Actually, looks like this project hasn't been updated in over a year. I'd consider this project dead now.

andria-dev avatar Jan 01 '20 16:01 andria-dev

Same here, any fixes?

sebolio avatar Mar 04 '20 16:03 sebolio

@sebolio add a <head></head> at the top

towc avatar Mar 04 '20 17:03 towc