Don't gzip woff files, as they usually already compressed
This commit is contained in:
@@ -280,6 +280,12 @@ func getMimeTypeByExtension(ext string) string {
|
|||||||
case ".md":
|
case ".md":
|
||||||
return "text/markdown"
|
return "text/markdown"
|
||||||
|
|
||||||
|
case ".woff":
|
||||||
|
return "application/font-woff"
|
||||||
|
|
||||||
|
case ".woff2":
|
||||||
|
return "application/font-woff2"
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return mime.TypeByExtension(ext)
|
return mime.TypeByExtension(ext)
|
||||||
}
|
}
|
||||||
@@ -310,6 +316,8 @@ func parseFile(
|
|||||||
|
|
||||||
if strings.HasPrefix(mimeType, "image/x-icon") {
|
if strings.HasPrefix(mimeType, "image/x-icon") {
|
||||||
// Don't compress icons
|
// Don't compress icons
|
||||||
|
} else if strings.HasPrefix(mimeType, "application/font-woff") {
|
||||||
|
// Don't compress web fonts
|
||||||
} else {
|
} else {
|
||||||
compressed := bytes.NewBuffer(make([]byte, 0, 1024))
|
compressed := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user