aboutsummaryrefslogtreecommitdiffhomepage
path: root/minifiers
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-08-14 19:24:33 +0200
committerBjørn Erik Pedersen <[email protected]>2018-08-14 19:24:33 +0200
commitc81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6 (patch)
tree74247f869150a728ea80a1873d674571037c974b /minifiers
parenta6f199f7a640161333608b4a843d701f7e182829 (diff)
downloadhugo-c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6.tar.gz
hugo-c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6.zip
minifiers: Make the JS minifier matcher less specific
Fixes #5073
Diffstat (limited to 'minifiers')
-rw-r--r--minifiers/minifiers.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/minifiers/minifiers.go b/minifiers/minifiers.go
index 70d42843f..eeebcd00f 100644
--- a/minifiers/minifiers.go
+++ b/minifiers/minifiers.go
@@ -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)