elm-lang / elm-reactor

Interactive development tool that makes it easy to develop and debug Elm programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`elm reactor` is basically unusable on a crappy connection because of the external font

lydell opened this issue · comments

I really like using elm reactor. It makes it so easy rapidly prototype things!

I also like coding on the train. There, the Internet connection ranges from okayish to awfully slow to none at all. It’s mostly in the “awfully slow” state.

So, what has the Internet connection on trains (in Sweden) to do with elm reactor? Basically, it boils down to this, which elm reactor includes in its served pages:

@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro);

Nothing on the page renders before that request is done. So each time I refresh a page served by elm reactor I stare at a blank page for several minutes, only accompanied by this little tooltip in the browser’s bottom left corner:

connecting-to-fonts

Usually, I just give up and run elm make src/Main.elm && open index.html instead.

Here are are a few alternatives:

  • Get rid of the external font and create a really good font stack instead with the nicest, most common monospace system fonts.
  • Load the font in a non-blocking way. Note that this might result in text being shown in a different font until the external font has loaded.
  • Simply close this issue if nobody else has the same problem :) (I guess I could find a browser extension that blocks certain requests or something.)

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.

@process-bot Here’s some extra info you asked for :)

OS: Ubuntu 16.04
Browser: Firefox Developer Edition 49.0a2
Elm: 0.17.0

Steps:

  1. Run elm reactor.
  2. Visit http://localhost:8000 in a browser.
  3. Click an .elm file on a crappy connection.

Thanks for the report, that's pretty lame! I did not know that @import worked like that. I can switch to using a <link> to load that info in and do it at the bottom of the page. There should be a 0.17.1 patch coming out relatively soon, so I'll make sure to get it in there!

Thanks for the update!

Your fix does seem to work on "directory listing" pages, but not on elm file pages:

$ elm reactor &
elm-reactor 0.17.1
Listening on http://localhost:8000/
$ curl -s http://localhost:8000/ | grep -o @import
$ curl -s http://localhost:8000/ | grep -o link
link
$ curl -s http://localhost:8000/src/Main.elm | grep link
$ curl -s http://localhost:8000/src/Main.elm | grep -o @import
@import

Note:

  • /: link found, and not @import.
  • /src/Main.elm: link not found, but @import found instead.