update tests and add debug templates log
This commit is contained in:
parent
695ea0a704
commit
b0c047ff9f
@ -22,8 +22,10 @@ func TestMain(m *testing.M) {
|
||||
f.Write([]byte("{{ define \"layout/another\" }}<p>layout.another.gohtml</p><p>{{ .Data.bar }}</p>{{ block \"base/content\" . }}{{ end }}{{ end }}"))
|
||||
f.Close()
|
||||
f, _ = os.Create("templates/fragment.button.gohtml")
|
||||
f.Write([]byte("{{ define \"fragment/button\" }}<button>{{ .Data.buttonText }}</button>{{ end }}"))
|
||||
f.Close()
|
||||
f, _ = os.Create("templates/component.list.gohtml")
|
||||
f.Write([]byte("{{ define \"component/list\" }}<ul>{{ range .Data.items }}{{ template \"fragment/button\" . }}{{ end }}</ul>{{ end }}"))
|
||||
f.Close()
|
||||
f, _ = os.Create("templates/page.tindex.gohtml")
|
||||
f.Write([]byte("{{ template \"layout/base\" .}}{{ define \"base/content\" }}<p>page.tindex.gohtml</p><p>{{ .Data.bar }}</p>{{ end }}"))
|
||||
|
||||
@ -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") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user