Repository: gohugoio/hugo (language: go)

Issue:
Change default value minify.tdewolff.html.keepWhitespace to false
Prior to [PR #8772](https://github.com/gohugoio/hugo/pull/8772) the default value for `minify.tdewolff.html.keepWhitespace` was `false`. We changed this to `true` due to an [upstream issue](https://github.com/tdewolff/minify/issues/427) that was resolved some time ago.

I was looking at a rendered HTML file _with a lot of list items_, and the size (bytes) caught my attention:

minify.tdewolff.html.keepWhitespace|minified|minified+gzipped
:--|--:|--:
true|108104|5432
false|59808|2858

Shaving 2.6 Kb from a served file isn't terribly exciting, but a 47% reduction in file size is.


Discussion / hints:
Those gzip numbers are incredible, though.

Fix patch:
diff --git a/minifiers/config.go b/minifiers/config.go
index e56617a06b6..675e5d2b87a 100644
--- a/minifiers/config.go
+++ b/minifiers/config.go
@@ -35,7 +35,7 @@ var defaultTdewolffConfig = tdewolffConfig{
 		KeepConditionalComments: true,
 		KeepEndTags:             true,
 		KeepDefaultAttrVals:     true,
-		KeepWhitespace:          true,
+		KeepWhitespace:          false,
 	},
 	CSS: css.Minifier{
 		Precision: 0,


Test patch:
diff --git a/minifiers/minifiers_test.go b/minifiers/minifiers_test.go
index ece8cbd08cf..9866f67da05 100644
--- a/minifiers/minifiers_test.go
+++ b/minifiers/minifiers_test.go
@@ -191,7 +191,7 @@ func TestDecodeConfigDecimalIsNowPrecision(t *testing.T) {
 
 }
 
-// Issue 8771
+// Issue 9456
 func TestDecodeConfigKeepWhitespace(t *testing.T) {
 	c := qt.New(t)
 	v := config.New()
@@ -214,7 +214,7 @@ func TestDecodeConfigKeepWhitespace(t *testing.T) {
 			KeepDocumentTags:        true,
 			KeepEndTags:             false,
 			KeepQuotes:              false,
-			KeepWhitespace:          true},
+			KeepWhitespace:          false},
 	)
 
 }
diff --git a/resources/resource_transformers/minifier/minify_test.go b/resources/resource_transformers/minifier/minify_test.go
index cc5f7af412f..b0ebe3171ac 100644
--- a/resources/resource_transformers/minifier/minify_test.go
+++ b/resources/resource_transformers/minifier/minify_test.go
@@ -38,5 +38,5 @@ func TestTransform(t *testing.T) {
 	c.Assert(transformed.RelPermalink(), qt.Equals, "/hugo.min.html")
 	content, err := transformed.(resource.ContentProvider).Content()
 	c.Assert(err, qt.IsNil)
-	c.Assert(content, qt.Equals, "<h1> Hugo Rocks! </h1>")
+	c.Assert(content, qt.Equals, "<h1>Hugo Rocks!</h1>")
 }