Skip to content

Instantly share code, notes, and snippets.

@danneu
Last active May 9, 2022 06:17
Show Gist options
  • Save danneu/77d9000d390098064cc30f66353a5562 to your computer and use it in GitHub Desktop.
Save danneu/77d9000d390098064cc30f66353a5562 to your computer and use it in GitHub Desktop.
Elm quickstart with Parcel

Elm quickstart with Parcel

mkdir my-elm-project
cd my-elm-project
elm init
echo '{}' > package.json
npm install -g parcel
touch example.css
touch index.html

Save Elm boilerplate to src/Main.elm: https://ellie-app.com/hphB4mjXYBpa1

Save this to index.html:

<!doctype html>
<head>
    <link rel="stylesheet" href="./example.css" />
    <script src="./src/Main.elm"></script>
</head>
<body>
    <main/>
    <script>
        const app = Elm.Main.init({
            node: document.querySelector('main')
        })
    </script>
</body>

Use parcel to run dev server:

parcel index.html
# Navigate browser to http://localhost:1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment