Stop gzip more file types: Text, MD

This commit is contained in:
NI
2020-07-16 09:34:32 +08:00
parent e1cbe2f2d0
commit c2da4491b0

View File

@@ -280,6 +280,12 @@ func getMimeTypeByExtension(ext string) string {
case ".md": case ".md":
return "text/markdown" return "text/markdown"
case ".map":
return "text/plain"
case ".txt":
return "text/plain"
case ".woff": case ".woff":
return "application/font-woff" return "application/font-woff"
@@ -318,6 +324,8 @@ func parseFile(
// Don't compress images // Don't compress images
} else if strings.HasPrefix(mimeType, "application/font-woff") { } else if strings.HasPrefix(mimeType, "application/font-woff") {
// Don't compress web fonts // Don't compress web fonts
} else if mimeType == "text/plain" {
// Don't compress plain text
} else { } else {
compressed := bytes.NewBuffer(make([]byte, 0, 1024)) compressed := bytes.NewBuffer(make([]byte, 0, 1024))