Skip to content

Conversation

@albertdahlin
Copy link
Contributor

@albertdahlin albertdahlin commented Jun 18, 2019

Fonts have their proper mime types since Feb 2017.

https://www.iana.org/assignments/media-types/media-types.xhtml#font

This fixes a problem when trying to use custom fonts hosted locally with elm reactor, for example using @font-face

For example

@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(/source-code-pro.woff2) format('woff2');
}

does not work with elm reactor.

When the font file is loaded it will be wrapped in a HTML document by the elm reactor server (at least in 0.19.0).

@evancz evancz closed this in 536d50c Jul 8, 2019
@evancz
Copy link
Member

evancz commented Jul 8, 2019

I added them in 536d50c, but with two variations:

  1. I kept the list alphabetical by extension. I don't know if that is ideal, but it seems good to stick to it and decide on a different order explicitly.
  2. This revealed that there was already an entry for .ttf but it looks like it needed to change from "application/x-font-truetype" to "font/ttf" based on the IANA documents you shared.

Let me know if everything looks alright in the patch, and the changes should be available with the next release of Elm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants