From: Bjørn Erik Pedersen Date: Sun, 15 Mar 2026 10:04:07 +0000 (+0100) Subject: tpl/css: Add a test case for rebuilds on CSS options changes X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=06fcb724219eecdc20367e86e1a8134d3d7e0e5b;p=brevno-suite%2Fhugo tpl/css: Add a test case for rebuilds on CSS options changes --- diff --git a/tpl/css/build_integration_test.go b/tpl/css/build_integration_test.go index dd674d63d..f3bf8117a 100644 --- a/tpl/css/build_integration_test.go +++ b/tpl/css/build_integration_test.go @@ -141,6 +141,34 @@ All. No CSS here. b.AssertFileContent("public/css/main.css", `.main{background:#00f}`) // updated content, blue gets minified to #00f. } +func TestCSSBuildEditOptions(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ["taxonomy", "term", "rss"] +disableLiveReload = true +-- assets/css/main.css -- +body { + background: red; +} +-- layouts/home.html -- +Home. +{{ with resources.Get "css/main.css" }} +{{ $opts := dict "minify" false }} +{{ with . | css.Build $opts }} + +{{ end }} +{{ end }} +` + + b := hugolib.TestRunning(t, files, hugolib.TestOptOsFs()) + b.AssertFileContent("public/css/main.css", ` background: red;`) + + b.EditFileReplaceAll("layouts/home.html", `"minify" false`, `"minify" true`).Build() + b.AssertFileContent("public/css/main.css", `{background:red}`) +} + func TestCSSBuildSourceMaps(t *testing.T) { t.Parallel()