how to setup elm development

lightweight create-elm-app

Jacob Chapman

Usually projects start small and grow from there. A good project structure is to make a new folder for your project then put all the stuff in there.

You don’t need Create Elm App. You just need elm init

Run `elm init` inside your new project folder then create an html file like this:

<script type="text/javascript" src="static/elm.js"></script>
<script>var app = Elm.Main.init({ node: document.querySelector('main') })</script> 

use this command for development:

elm-live src/Main.elm -- --output=static/elm.js --debug

use this makefile for production builds:

mkdir -p ./build        
cp -r index.html assets static build/        
elm make --output=build/elm.js  --optimize src/Main.elm        
uglifyjs build/elm.js \            --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \            | uglifyjs --mangle --output=build/elm.min.js        
mv build/elm.min.js build/static/elm.js

folder looks like this:

├── assets

│ ├── css

├── src

│ ├── Main.elm

├── Makefile

├── index.html

├── static

└── build

│ ├── assets

│ └── static