deps: Update github.com/tdewolff/minify/v2 v2.20.9 => v2.20.13

KeepConditionalComments was deprecated in the upstream library and replaced with KeepSpecialComments. This new option reflects that both conditional comments and Server Side Include comments can be optionally stripped by the minifier. As with KeepConditionalComments, the minifier is configured not to strip them by default.
This commit is contained in:
James Tatum
2024-01-11 13:30:42 -08:00
committed by Bjørn Erik Pedersen
parent a541e3b4d4
commit 8915343075
6 changed files with 90 additions and 20 deletions

View File

@@ -59,3 +59,45 @@ func TestConfigLegacy(t *testing.T) {
conf := testconfig.GetTestConfigs(nil, v).Base.Minify
c.Assert(conf.MinifyOutput, qt.Equals, true)
}
func TestConfigNewCommentOptions(t *testing.T) {
c := qt.New(t)
v := config.New()
// setting the old options should automatically set the new options
v.Set("minify", map[string]any{
"tdewolff": map[string]any{
"html": map[string]any{
"keepConditionalComments": false,
},
"svg": map[string]any{
"decimal": "5",
},
},
})
conf := testconfig.GetTestConfigs(nil, v).Base.Minify
c.Assert(conf.Tdewolff.HTML.KeepSpecialComments, qt.Equals, false)
c.Assert(conf.Tdewolff.SVG.Precision, qt.Equals, 5)
// the new values should win, regardless of the contents of the old values
v = config.New()
v.Set("minify", map[string]any{
"tdewolff": map[string]any{
"html": map[string]any{
"keepConditionalComments": false,
"keepSpecialComments": true,
},
"svg": map[string]any{
"decimal": "5",
"precision": "10",
},
},
})
conf = testconfig.GetTestConfigs(nil, v).Base.Minify
c.Assert(conf.Tdewolff.HTML.KeepSpecialComments, qt.Equals, true)
c.Assert(conf.Tdewolff.SVG.Precision, qt.Equals, 10)
}