ref: c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6
parent: a6f199f7a640161333608b4a843d701f7e182829
author: Bjørn Erik Pedersen <[email protected]>
date: Tue Aug 14 15:24:33 EDT 2018
minifiers: Make the JS minifier matcher less specific Fixes #5073
--- a/minifiers/minifiers.go
+++ b/minifiers/minifiers.go
@@ -18,6 +18,7 @@
import (
"io"
+ "regexp"
"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/transform"
@@ -70,6 +71,7 @@
// 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)