You should have Elm platform installed on your computer, the following tutorial is written with the assumption, that you are familiar with terminal.
Create a folder and navigate to it with your terminal:
$ mkdir elm-app
$ cd elm-app/
Initialize Elm project and install core dependencies:
$ elm-package install -y
elm-package.json
and elm-stuff
folder should appear in your project.
Create the entry point for your application Main.elm
and paste Hello World example in to it.
To build your first project, run:
$ elm-make Main.elm
This will produce index.html
with the Main.elm
file (and all dependencies) compiled into JavaScript and inlined into the HTML. Try and open it in your browser!
If this fails with the error I cannot find module 'Html'.
it means that you are not using the latest version of Elm. You can solve the problem either by upgrading Elm and redoing the first step, or with the following command:
$ elm-package install elm-lang/html -y
In case you have your own index.html
file (eg. when working with ports), you can also compile your Elm files to a JavaScript file:
$ elm-make Main.elm --output=elm.js
More info in the example Embedding into HTML.