elm-reactor
elm-reactor copied to clipboard
WOFF font files are not served with a correct MIME type (application/font-woff)
As WOFF fonts are (slightly) more widely supported by browsers then TTF fonts (see http://caniuse.com/#feat=woff versus http://caniuse.com/#feat=ttf) I wanted to use them in my app, but it turns out, elm-reactor won't serve them with the correct MIME type. According to https://www.w3.org/TR/WOFF/#appendix-b the MIME type should be application/font-woff
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
@martincerny does this fail for WOFF2 as well?
I have not tested, but very likely not - the list of MIME types in https://github.com/elm-lang/elm-reactor/blob/master/src/backend/Main.hs (search for "mimeTypeDict") does not contain woff2.
I have a similar issue, not sure if I should have better opened a separate one. It's also a problem with the mime type.
I'm working on a parser for wavefront .obj files. (here)
Elm reactor serves my .obj
files as text/html
instead of text/plain
.
It also adds some additional unwanted syntax highlighting code to it: This is the output from elm reactor:
<!DOCTYPE HTML>
<html><head><meta charset="UTF-8"><title>~/suzanne.obj</title><style type="text/css">@import url(http://fonts.googleapis.com/css?family=Source+Code+Pro);
html, head, body, pre {
margin: 0;
height: 100%;
}
body {
font-family: 'Source Code Pro', monospace;
}
</style><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css"><script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js"></script><script>if (hljs) { hljs.initHighlightingOnLoad(); }</script></head><body style="background-color: #F0F0F0;"><pre><code># Blender3D v249 OBJ File: suzanne.blend
# www.blender3d.org
v 0.437500 0.164063 0.765625
v -0.437500 0.164063 0.765625
v 0.500000 0.093750 0.687500
...
file
tells me it's text/plain
:
↪ file --mime-type suzanne.obj
suzanne.obj: text/plain
As a workaround I'm currently using python -m http.server
.
But I miss elm reactor :cry: