diff options
Diffstat (limited to 'internal/builder')
-rw-r--r-- | internal/builder/builder.go | 1 | ||||
-rw-r--r-- | internal/builder/page.templ | 8 | ||||
-rw-r--r-- | internal/builder/template.go | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/internal/builder/builder.go b/internal/builder/builder.go index b4ade4a..44ab402 100644 --- a/internal/builder/builder.go +++ b/internal/builder/builder.go @@ -267,5 +267,6 @@ func BuildSite(ioConfig IOConfig) (*Result, error) { } } + loadCSS() return build(ioConfig.Destination, *config) } diff --git a/internal/builder/page.templ b/internal/builder/page.templ index c99e315..7b3380f 100644 --- a/internal/builder/page.templ +++ b/internal/builder/page.templ @@ -52,6 +52,14 @@ templ page(site config.Config, page PageSettings) { <a href="https://opensource.org/licenses/MIT">MIT</a> </footer> @counter(page.Path, page.Title) + if site.InjectLiveReload { + <script defer> + new EventSource("/_/reload").onmessage = event => { + console.log("got message", event) + window.location.reload() + }; + </script> + } </body> </html> } diff --git a/internal/builder/template.go b/internal/builder/template.go index 9b1d9bd..53199fc 100644 --- a/internal/builder/template.go +++ b/internal/builder/template.go @@ -30,7 +30,7 @@ var ( } ) -func init() { +func loadCSS() { bytes, err := os.ReadFile("templates/style.css") if err != nil { panic(err) |