Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile multiple embedded Elm app

Tags:

elm

I'm trying to understand the "elm-make" command. I built 2 .elm files call Foo.elm and Bar.elm. I'd like to display them in a HTML file of this format :

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript" src="elm.js"></script>
  </head>
  <body>
    <h2>Foo</h2>
    <div id="foo-app"></div>
    <h2>Bar</h2>
    <div id="bar-app"></div>
  </body>

  <script type="text/javascript">
    Elm.embed(Elm.Foo, document.getElementById("foo-app"));
    Elm.embed(Elm.Bar, document.getElementById("bar-app"));
  </script>
</html>

But Elm.Foo and Elm.Bar do not exist. Only Elm.Main.

Tried to compile with this command: elm make Foo.elm Bar.elm --output elm.js. What am I doing wrong ?

like image 950
doobdargent Avatar asked Dec 29 '25 20:12

doobdargent


1 Answers

It's because I did not have the module declared at the top of my files, so it implied Main :

module Foo where 
like image 170
doobdargent Avatar answered Jan 01 '26 18:01

doobdargent