Skip to content

paramander/elm-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-watcher

A simple file watcher for Elm source files to recompile and output it to a JS file.

Reason

We needed a solution like this because we want our backend to be written in Haskell, and our frontend in Elm. Having to recompile/rebuild Elm AND Haskell would soon be a pain, so this package was developed.

It uses the Compile.compile method from elm-compiler but with an added output FilePath.

Usage

To use this in your Haskell codebase, integrate it in your development main method:


-- src/backend/devel.hs

import qualified Watcher as EW -- import elm-watcher

main :: IO ()
main = do
    let elmWatcherConfig = EW.WatchConfig { watchDir = "src/frontend"
                                          , compileFile = "Main.elm"
                                          , outputDir = "static/app.js"
                                          }
    forkIO $ EW.watchWithConfig elmWatcherConfig
    -- rest of your code, like spawning a warp server...

About

A simple file watcher to recompile Elm files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published