Skip to content

Instantly share code, notes, and snippets.

@Bernardoow
Created January 30, 2017 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bernardoow/c8eca19071d474bbb2a49e813c4a7bd3 to your computer and use it in GitHub Desktop.
Save Bernardoow/c8eca19071d474bbb2a49e813c4a7bd3 to your computer and use it in GitHub Desktop.
Load external CSS in Elm
{--
You *can* load an external CSS file in Elm, but currently,
in Pure Elm that means adding a style element to the body instead of the head.
It does cause a flash of unstyled content, so I think it's only useful
for testing in Reactor.
--}
import Html exposing (..)
import Html.Attributes exposing (..)
stylesheet =
let
tag = "link"
attrs =
[ attribute "rel" "stylesheet"
, attribute "property" "stylesheet"
, attribute "href" "//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
]
children = []
in
node tag attrs children
main =
let
inner = div [id "inner", class "container"] [h1 [class "text-center"] [text "hello flash of unstyled content"]]
hero = div [id "hero", class "jumbotron"] [inner]
in
div [id "outer"] [stylesheet, hero]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment