Skip to content

eeue56/elm-server-side-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-server-side-renderer

Take a Html msg element and turn it into a string.

> import HtmlToString exposing (htmlToString)
> import Html
> ourDiv = Html.div [ ] [ Html.text "hello world" ]
> htmlToString ourDiv
"<div>hello world</div>" : String


> import Html.Attributes exposing (class)
> ourDiv = Html.div [ class "donkey" ] [ Html.text "hello world" ]
> htmlToString ourDiv
"<div class=\"donkey\">hello world</div>" : String


> import Html.Attributes exposing (class, style)
> ourDiv = Html.div [ class "donkey", style [ ("color", "red") ] ] [ Html.text "hello world" ]
> htmlToString ourDiv
"<div class=\"donkey\" style=\"color:red\">hello world</div>" : String