From b0c047ff9f1b8af32d77fb4d5e31588f0df9c6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20P=C3=A9rez?= Date: Sat, 10 May 2025 19:58:39 +0200 Subject: [PATCH] update tests and add debug templates log --- ron_test.go | 2 ++ template.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ron_test.go b/ron_test.go index 3afda12..264f098 100644 --- a/ron_test.go +++ b/ron_test.go @@ -22,8 +22,10 @@ func TestMain(m *testing.M) { f.Write([]byte("{{ define \"layout/another\" }}

layout.another.gohtml

{{ .Data.bar }}

{{ block \"base/content\" . }}{{ end }}{{ end }}")) f.Close() f, _ = os.Create("templates/fragment.button.gohtml") + f.Write([]byte("{{ define \"fragment/button\" }}{{ end }}")) f.Close() f, _ = os.Create("templates/component.list.gohtml") + f.Write([]byte("{{ define \"component/list\" }}{{ end }}")) f.Close() f, _ = os.Create("templates/page.tindex.gohtml") f.Write([]byte("{{ template \"layout/base\" .}}{{ define \"base/content\" }}

page.tindex.gohtml

{{ .Data.bar }}

{{ end }}")) diff --git a/template.go b/template.go index 5ae5c1e..90bc1b9 100644 --- a/template.go +++ b/template.go @@ -142,6 +142,8 @@ func (re *Render) createTemplateCache() (templateCache, error) { return cache, err } + slog.Debug("templates", "templates", templates) + for _, file := range templates { filePathBase := filepath.Base(file) if strings.Contains(filePathBase, "layout") || strings.Contains(filePathBase, "fragment") {