mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
minifiers: Update deprecation handling
1. With minify.tdewolff.css and minify.tdewolff.svg, check for "decimals" instead of "decimal" 2. Add deprecation messages for: - minify.tdewolff.css.decimals - minify.tdewolff.svg.decimals - minify.tdewolff.html.keepconditionalcomments - config root minify (bool) - config root minifyoutput (bool) 3. Deprecate minify.tdewolff.css.keepcss2 in favor of minify.tdewolff.css.version 4. Refactor minify configuration tests Closes #11893 Closes #13947 Closes #13948
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
0071b47b8b
commit
a09b8a60eb
@@ -26,7 +26,6 @@ import (
|
||||
"github.com/gohugoio/hugo/minifiers"
|
||||
"github.com/gohugoio/hugo/output"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/tdewolff/minify/v2/html"
|
||||
)
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
@@ -166,51 +165,3 @@ func TestBugs(t *testing.T) {
|
||||
c.Assert(b.String(), qt.Equals, test.expectedMinString)
|
||||
}
|
||||
}
|
||||
|
||||
// Renamed to Precision in v2.7.0. Check that we support both.
|
||||
func TestDecodeConfigDecimalIsNowPrecision(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
v := config.New()
|
||||
v.Set("minify", map[string]any{
|
||||
"disablexml": true,
|
||||
"tdewolff": map[string]any{
|
||||
"css": map[string]any{
|
||||
"decimal": 3,
|
||||
},
|
||||
"svg": map[string]any{
|
||||
"decimal": 3,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
conf := testconfig.GetTestConfigs(nil, v).Base.Minify
|
||||
|
||||
c.Assert(conf.Tdewolff.CSS.Precision, qt.Equals, 3)
|
||||
}
|
||||
|
||||
// Issue 9456
|
||||
func TestDecodeConfigKeepWhitespace(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
v := config.New()
|
||||
v.Set("minify", map[string]any{
|
||||
"tdewolff": map[string]any{
|
||||
"html": map[string]any{
|
||||
"keepEndTags": false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
conf := testconfig.GetTestConfigs(nil, v).Base.Minify
|
||||
|
||||
c.Assert(conf.Tdewolff.HTML, qt.DeepEquals,
|
||||
html.Minifier{
|
||||
KeepComments: false,
|
||||
KeepSpecialComments: true,
|
||||
KeepDefaultAttrVals: true,
|
||||
KeepDocumentTags: true,
|
||||
KeepEndTags: false,
|
||||
KeepQuotes: false,
|
||||
KeepWhitespace: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user