mkdir my-elm-project
cd my-elm-project
elm init
echo '{}' > package.json
npm install -g parcel
touch example.css
touch index.htmlSave 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