Skip to content

Commit

Permalink
minifiers: Make the JS minifier matcher less specific
Browse files Browse the repository at this point in the history
Fixes #5073
  • Loading branch information
bep committed Aug 14, 2018
1 parent a6f199f commit c81fbf4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions minifiers/minifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package minifiers

import (
"io"
"regexp"

"github.com/gohugoio/hugo/output"
"github.com/gohugoio/hugo/transform"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c81fbf4

Please sign in to comment.