Skip to content

Instantly share code, notes, and snippets.

@evancz
Created August 5, 2015 07:35
Show Gist options
  • Save evancz/318b5f978d25e90916cf to your computer and use it in GitHub Desktop.
Save evancz/318b5f978d25e90916cf to your computer and use it in GitHub Desktop.

Setting up a Project

Run the following commands to create a directory for your project and then download the necessary packages:

mkdir my-elm-project
cd my-elm-project

elm-package install evancz/elm-html --yes
elm-package install evancz/elm-http --yes
elm-package install evancz/elm-components --yes

Your directory structure should now be like this:

my-elm-project/
    elm-stuff/
    elm-package.json

You should never need to look in elm-stuff/, it is entirely managed by the Elm build tool elm-make and package manager elm-package.

The elm-package.json file is interesting though. Open it up and check it out. The most interesting fields for you are probably:

  • source-directories — lists the directories in your project that have Elm source code. I like to set this equal to [ "src" ] and put all of my code in a src/ directory.

  • dependencies — This lists all the packages you need. Depending on what you want to do, you should use these bounds differently:

    • Creating a product — you want to crush those ranges down to things like 3.0.4 <= v <= 3.0.4 such that you can use exact versions.

    • Creating a package — you want to make these ranges exactly as wide as you have tested. Best practice is to start with them within a single major version and then expand as new versions come out and you test that things still work.

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