diff --git a/core/fonts/private/GetMediaType.html b/core/fonts/private/GetMediaType.html index d603bf4..dccf608 100644 --- a/core/fonts/private/GetMediaType.html +++ b/core/fonts/private/GetMediaType.html @@ -11,14 +11,30 @@ @returns String */}} +{{ $MainType := "font" }} {{ $SubType := "woff2" }} -{{/* It appears CloudFlare produces an empty string when calling .MediaType.SubType on a woff2... +{{/* It appears CloudFlare produces an empty string when calling .MediaType.MainType or .MediaType.SubType on a woff2... As this is by far the best font format these days in terms of support and optimization, making it default to ensure it is not botched by cloudflare is "ok". */}} {{ with .MediaType.SubType }} {{ $SubType = . }} {{ end }} -{{ $MainType := .MediaType.MainType }} +{{ with .MediaType.MainType }} + {{ $MainType = . }} +{{ end }} + +{{ $MediaType := "%s/%s" $MainType $SubType }} + +{{/* Another weirdness for some files depending on hosting plaftorm. + Some woff file would return application/font-woff + But Chrome will print a ` has an unsupported `type` value` warning on non-font "types". +*/}} +{{ $irregular := dict + "application/font-woff" "font/woff" +}} +{{ with index $irregular $format }} + {{ $format = . }} +{{ end }} {{ return printf "%s/%s" $MainType $SubType }} \ No newline at end of file