elm-make: A build tool for Elm projects

[ bsd3, build-tool, deprecated, program ] [ Propose Tags ]
Deprecated.

A nice way to build projects that is aware of both elm-compile and elm-package, so it can make the build process very smooth.

Versions 0.1, 0.1.1, 0.1.2 ansi-wl-pprint, base (>=4.2 && <5), binary, blaze-html, blaze-markup, bytestring, containers (>=0.3), directory, elm-compiler (==0.15.*), elm-package, filepath, mtl, optparse-applicative (==0.10.*), text [details] BSD-3-Clause Copyright (c) 2014 Evan Czaplicki Evan Czaplicki info@elm-lang.org Build Tool http://elm-lang.org head: git clone git://github.com/elm-lang/elm-make.git by EvanCzaplicki at Mon Apr 20 06:41:11 UTC 2015 elm-make 2274 total (39 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs not available Last success reported on 2015-05-19 Hackage Matrix CI

Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]

elm-make

elm-make is a build tool for Elm.

• Compile down to JS or HTML — turn Elm files into artifacts that can be used with whatever backend you are already using.

• Build in parallel — if you have four cores, elm-make will try to compile four files at all times.

• Build dependencieselm-make is designed to work with elm-package so if you use a bunch of 3rd party packages they will all work just fine.

• Build what you need — if a module is not needed for your project it will not be built or appear in the resulting JS or HTML.

Basic Usage

Your Elm projects should all have a root directory, like project/ that all of your Elm related stuff is going to live in. Lets imagine having the following directory structure.

project/
Main.elm
SearchBox.elm
SearchResults.elm
Theme.elm


We have a couple Elm modules, maybe they depend on each other in some way. To turn this into JavaScript, you can run the following command:

elm-make Main.elm --output=main.html


Before creating an HTML file called main.html, this will prompt you to install elm-lang/core which contains all of the core modules needed to make Elm programs work.

It will also create a file called elm-package.json which gives a structured description of your project. elm-make uses this file to figure out what directories it needs to look in and which packages are relevant.

A lot of the more advanced stuff involves fiddling with elm-package.json to make your directory structure nicer or to make sure you are working with the right dependencies.

Directory Structure

In the Basic Usage section above, we saw a pretty boring directory structure. As we actually used it, it would probably expand to look like this:

project/
elm-package.json
elm-stuff/...
Main.elm
SearchBox.elm
SearchResults.elm
Theme.elm


Pretty messy! There is a field in elm-package.json called source-directories that allows you to list all the directories that contain Elm modules. By default it only lists the root directory . but it is best to change that a bit. If you are doing an Elm only project, this structure is pretty nice.

project/
src/
Main.elm
SearchBox.elm
SearchResults.elm
Theme.elm
elm-package.json


I would set "source-directories": [ "src" ] keeping the root of the project as clean as possible.

If you have a project that has both frontend and backend components, I have been experimenting with this directory structure.

project/
backend/...
frontend/
Main.elm
SearchBox.elm
SearchResults.elm
Theme.elm
elm-package.json

In this world you set "source-directories": [ "frontend" ]. This pattern is used for the package.elm-lang.org project and seems to work pretty well.
2. If you are creating an app or product, you want to keep your dependency ranges very specific. When you build, a file is generated called elm-stuff/exact-dependencies.json which lists all of the packages needed for your project and the exact versions you happen to be using right now. You may want to check this in to version control if you want the same exact thing every time.