minifiers: Make the JS minifier matcher less specific

Fixes #5073
This commit is contained in:
Bjørn Erik Pedersen 2018-08-14 19:24:33 +02:00
parent a6f199f7a6
commit c81fbf4625
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -18,6 +18,7 @@ package minifiers
import (
"io"
"regexp"
"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/transform"
@ -70,6 +71,7 @@ func New(mediaTypes media.Types, outputFormats output.Formats) Client {
// We use the Type definition of the media types defined in the site if found.
addMinifierFunc(m, mediaTypes, "text/css", "css", css.Minify)
addMinifierFunc(m, mediaTypes, "application/javascript", "js", js.Minify)
m.AddFuncRegexp(regexp.MustCompile("^(application|text)/(x-)?(java|ecma)script$"), js.Minify)
addMinifierFunc(m, mediaTypes, "application/json", "json", json.Minify)
addMinifierFunc(m, mediaTypes, "image/svg+xml", "svg", svg.Minify)
addMinifierFunc(m, mediaTypes, "application/xml", "xml", xml.Minify)