mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03:00
Improve minifier MIME type resolution
This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`. Fixes #5093
This commit is contained in:
parent
6b9934a266
commit
ebb56e8bdb
8 changed files with 87 additions and 106 deletions
|
@ -276,14 +276,12 @@ disableKinds = ["page", "section", "taxonomy", "taxonomyTerm", "sitemap", "robot
|
|||
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/nodot"]
|
||||
suffix = ""
|
||||
delimiter = ""
|
||||
[mediaTypes."text/defaultdelim"]
|
||||
suffix = "defd"
|
||||
suffixes = ["defd"]
|
||||
[mediaTypes."text/nosuffix"]
|
||||
suffix = ""
|
||||
[mediaTypes."text/customdelim"]
|
||||
suffix = "del"
|
||||
suffixes = ["del"]
|
||||
delimiter = "_"
|
||||
|
||||
[outputs]
|
||||
|
@ -321,7 +319,7 @@ baseName = "customdelimbase"
|
|||
th.assertFileContent("public/_redirects", "a dotless")
|
||||
th.assertFileContent("public/defaultdelimbase.defd", "default delimim")
|
||||
// This looks weird, but the user has chosen this definition.
|
||||
th.assertFileContent("public/nosuffixbase.", "no suffix")
|
||||
th.assertFileContent("public/nosuffixbase", "no suffix")
|
||||
th.assertFileContent("public/customdelimbase_del", "custom delim")
|
||||
|
||||
s := h.Sites[0]
|
||||
|
@ -332,7 +330,7 @@ baseName = "customdelimbase"
|
|||
|
||||
require.Equal(t, "/blog/_redirects", outputs.Get("DOTLESS").RelPermalink())
|
||||
require.Equal(t, "/blog/defaultdelimbase.defd", outputs.Get("DEF").RelPermalink())
|
||||
require.Equal(t, "/blog/nosuffixbase.", outputs.Get("NOS").RelPermalink())
|
||||
require.Equal(t, "/blog/nosuffixbase", outputs.Get("NOS").RelPermalink())
|
||||
require.Equal(t, "/blog/customdelimbase_del", outputs.Get("CUS").RelPermalink())
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue