Skip to content
/ sbt-with-elm Public template

a way to make sbt compile elm code

Notifications You must be signed in to change notification settings

tvoklov/sbt-with-elm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

how to use

  • add ElmCompile to your /project/ folder
  • add enablePlugins(ElmCompile) in your build.sbt
  • change the defaults if needed

what this does

inserts a step into sbt's compilation that compiles elm code and then puts it as a resource into the resulting jar

this also adds elm's sources to sbt's watch triggers, meaning that commands like ~run will actually work (uh, well, read this first though)

what for

to package both front and backend code into one jar

what are the defaults

sbt key description default
elmSrcDirectory elm source root src/main/elm
elmMainFile elm main file (relative to source root) Main.elm
elmOutputFile compiled js location in jar elm/elm.js

what are the requirements

  • elm to be installed and be accessible from your system's terminal

what you can use this for

read through the plugin file if you want to learn one way to make sbt compile your elm/ts/whatever code and put it right into your jar. all in a clean, non-hardcoded, no ".gitignore the compiled junk" way

OR

on continuous compilation

elm sources are added as watch triggers to sbt's compile task. what this means is that when continous compilation is used, changes to elm sources will trigger a recompile (if you've used PlayFramework, it's kind of like its development mode but it also includes elm files)

there is a catch though. sbt will not stop any process that runs continuously, meaning something like a web server (which is probably what you will be using this template for) will not be stopped to be recompiled.

you should use something like sbt-revolver in conjunction with this plugin to continously compile your web server

About

a way to make sbt compile elm code

Topics

Resources

Stars

Watchers

Forks