Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Created December 7, 2018 16:42
Show Gist options
  • Select an option

  • Save benkoshy/b15f5b4a7f76fd8353f4fdf27fec9f0c to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/b15f5b4a7f76fd8353f4fdf27fec9f0c to your computer and use it in GitHub Desktop.
ELM 0.19 - A Simple ELM Programming

If you're following along the Beginning Elm book then, after much stuggle, this is the code which worked for me. I hope it saves you a lot of heartache.

HomePage.elm

module Main exposing (..)

import Html exposing (..)
import Html.Attributes exposing (..)


view model =
    div [ class "jumbotron" ]
        [ h1 [] [ text "Welcome to Dunder Mifflin!" ]
        , p []
            [ text "Dunder Mifflin Inc. (stock symbol "
            , strong [] [ text "DMI" ]
            , text ") is a micro-cap regional paper and office supply distributor with an emphasis on servicing small-business clients."
            ]
        ]


main =
    view "dummy model"    

Index.html

<!DOCTYPE html>
<html>
  <head>
  	<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

    <style>
      .jumbotron {
        background-color: #e6ffe6;
        text-align: center;
      }
    </style>
  </head>

  <body>
    <div id="elm-code-is-loaded-here"></div>

    <script src="elm.js"></script>
    <script>
      const app = Elm.Main.init({node:  document.getElementById("elm-code-is-loaded-here") });
    </script>
  </body>
</html>
@robwebbjr
Copy link
Copy Markdown

Thank you; this really helped a lot!

@treborg
Copy link
Copy Markdown

treborg commented May 12, 2019

Thank you! This really helped me also.

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