DenoDDeno
Powered by
Kevin TaleK
Denoβ€’16mo agoβ€’
29 replies
Kevin Tale

How to add a simple live reload?

Consider this super simple codebase

app/
  index.html
  main.ts
app/
  index.html
  main.ts

// main.ts
const content = Deno.readTextFileSync("./index.html");

Deno.serve(() => new Response(content, {
        headers: { "Content-Type": "text/html" },
    })
);
// main.ts
const content = Deno.readTextFileSync("./index.html");

Deno.serve(() => new Response(content, {
        headers: { "Content-Type": "text/html" },
    })
);

// index.html
<p>Hello world</p>
// index.html
<p>Hello world</p>


Then I run
deno run -A -r --watch main.ts
deno run -A -r --watch main.ts
.

http://localhost:8000/
http://localhost:8000/
will correctly serve my html content but how can I enable somekind of live reload where if I edit my
index.html
index.html
in VSCode it will effectively show the updated
index.html
index.html
in my browser?

thanks
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

[Fresh 2] How to a add tailwind plugins?
vicaryVvicary / help
6mo ago
How do I send a simple text file to the printer?
BairdyBBairdy / help
3y ago
dwm hot reload
TangJieHaoTTangJieHao / help
2y ago