mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Fix panic on server rebuilds when using both base templates and template.Defer
Fixes #12963
This commit is contained in:
@@ -721,43 +721,3 @@ console.log("config.params.id", id3);
|
||||
b.EditFileReplaceAll("assets/other/bar.css", ".bar-edit {", ".bar-edit2 {").Build()
|
||||
b.AssertFileContent("public/mybundle/reactbatch.css", ".bar-edit2 {")
|
||||
}
|
||||
|
||||
func TestEditBaseofManyTimes(t *testing.T) {
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
baseURL = "https://example.com"
|
||||
disableLiveReload = true
|
||||
disableKinds = ["taxonomy", "term"]
|
||||
-- layouts/_default/baseof.html --
|
||||
Baseof.
|
||||
{{ block "main" . }}{{ end }}
|
||||
{{ with (templates.Defer (dict "key" "global")) }}
|
||||
Now. {{ now }}
|
||||
{{ end }}
|
||||
-- layouts/_default/single.html --
|
||||
{{ define "main" }}
|
||||
Single.
|
||||
{{ end }}
|
||||
--
|
||||
-- layouts/_default/list.html --
|
||||
{{ define "main" }}
|
||||
List.
|
||||
{{ end }}
|
||||
-- content/mybundle/index.md --
|
||||
---
|
||||
title: "My Bundle"
|
||||
---
|
||||
-- content/_index.md --
|
||||
---
|
||||
title: "Home"
|
||||
---
|
||||
`
|
||||
|
||||
b := hugolib.TestRunning(t, files)
|
||||
b.AssertFileContent("public/index.html", "Baseof.")
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
b.EditFileReplaceAll("layouts/_default/baseof.html", "Now", "Now.").Build()
|
||||
b.AssertFileContent("public/index.html", "Now..")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user