Skip to content

Commit 8fb5cd5

Browse files
committed
feat: Enable live reload
1 parent 625c325 commit 8fb5cd5

File tree

6 files changed

+35
-3
lines changed

6 files changed

+35
-3
lines changed

dashboard/views/RootPage.templ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ package views
22

33
templ RootPage() {
44
@Layout() {
5-
Hallo asdadsaasdas
5+
Hallo Welt
66
}
77
}

dashboard/views/RootPage_templ.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboard/views/layout.templ

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ templ Layout() {
2828
<main class="flex items-center justify-center grow">
2929
{ children... }
3030
</main>
31+
if url := os.Getenv("REFRESH_LIVE_RELOAD_SCRIPT_URL"); url != "" {
32+
<script src={ url }></script>
33+
}
3134
</body>
3235
</html>
3336
}

dashboard/views/layout_templ.go

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func main() {
3333
)
3434
slog.SetDefault(logger)
3535

36+
http.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) {
37+
w.WriteHeader(http.StatusOK)
38+
})
39+
3640
// 2. Create an HTTP client with devlog middleware (RoundTripper)
3741

3842
httpClient := &http.Client{

example/refresh.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ enable_colors: true
2020
log_name: ""
2121
# Enable a live reload server that pushes an SSE event to the client when the app was rebuilt.
2222
live_reload: true
23+
# A URL to check the readyness of the application before sending a reload event.
24+
readyness_url: http://localhost:1095/healthz

0 commit comments

Comments
 (0)