mattdesl / budo

:clapper: a dev server for rapid prototyping
MIT License
2.17k stars 106 forks source link

Live reloading and static dir change #215

Open mattstyles opened 7 years ago

mattstyles commented 7 years ago
budo src/index.js --live --dir=src

If you're serving a static src/index.html file then budo serves that just fine but the live reload js file from the default static file isn't included and it doesn’t seem to be running on 35729 so my browser live-reload plugin can't pick up a server to listen to.

I created a repo that exhibits this.

console output for budo suggests live-reload is running somewhere:

[0000] info  Server running at http://169.254.249.217:9966/ (connect)
[0000] info  LiveReload running

budo@9 tells me LiveReload is running on the standard port and my browser has no issues connecting to it, this is only an issue with budo@10

In case it makes any difference I'm using node@8

Happy to dig in to this but not exactly sure where to start, I'm guessing with budo's live-reload implementation?

mattdesl commented 6 years ago

Sorry about the delay, this got lost in my inbox.

It's most likely because the HTML is just a single <script> tag, not a HTML document. You should either use a proper HTML doc with <html>...</html> or wrap your script tag in a body:

<body><script src='./index.js'></script></body>

I think there should also be a way to fix your use case by modifying inject-lr-script, I'd be open to PRs.