mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
hugolib: Fix bundle resource publishing when multiple output formats
The faulty logic published the bundled resources for the "first output" format. This worked most of the time, but since the output formats list is sorted, any output format only used for some of the pages (e.g. CSS) would not work properly. Fixes #5858
This commit is contained in:
@@ -896,3 +896,37 @@ TheContent.
|
||||
|
||||
return ps, clean, workDir
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/5858
|
||||
func TestBundledResourcesWhenMultipleOutputFormats(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
b := newTestSitesBuilder(t).Running().WithConfigFile("toml", `
|
||||
baseURL = "https://example.org"
|
||||
[outputs]
|
||||
# This looks odd, but it triggers the behaviour in #5858
|
||||
# The total output formats list gets sorted, so CSS before HTML.
|
||||
home = [ "CSS" ]
|
||||
|
||||
`)
|
||||
b.WithContent("mybundle/index.md", `
|
||||
---
|
||||
title: Page
|
||||
date: 2017-01-15
|
||||
---
|
||||
`,
|
||||
"mybundle/data.json", "MyData",
|
||||
)
|
||||
|
||||
b.CreateSites().Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/mybundle/data.json", "MyData")
|
||||
|
||||
// Change the bundled JSON file and make sure it gets republished.
|
||||
b.EditFiles("content/mybundle/data.json", "My changed data")
|
||||
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/mybundle/data.json", "My changed data")
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user