on master help sign in
Change the Generate.Html.sandwich
af3bc72Evan Czaplicki
compiler/src/Generate/Html.hs+17−5
@@ -24,18 +24,30 @@ sandwich moduleName javascript =
24<head>
24<head>
25 <meta charset="UTF-8">
25 <meta charset="UTF-8">
26 <title>|] <> name <> [r|</title>
26 <title>|] <> name <> [r|</title>
27+ <style>body { padding: 0; margin: 0; }</style>
27</head>
28</head>
28
29
29<body>
30<body>
30−<div id="elm-df98db9626"></div>
31+
32+<pre id="elm">
33+This is a headless program, meaning there is nothing to show here.
34+
35+I started the program anyway though!
36+
37+You can access it as `app` in the developer console.
38+</pre>
39+
31<script>
40<script>
32|] <> javascript <> [r|
41|] <> javascript <> [r|
33
42
43+try {
34−var app = Elm.|] <> name <> [r|.init({ node: document.getElementById("elm-df98db9626") });
44+ var app = Elm.|] <> name <> [r|.init({ node: document.getElementById("elm") });
35−if (document.getElementById("elm-df98db9626"))
45+} catch (e) {
36−{
46+ // display initialization errors (e.g. bad flags, infinite recursion)
37− document.getElementById("elm-df98db9626").innerText = 'This is a headless program, meaning there is nothing to show here.\n\nI started the program anyway though, and you can access it as `app` in the developer console.';
47+ document.getElementById("elm").innerText = e;
48+ throw e;
38}
49}
39</script>
50</script>
51+
40</body>
52</body>
41</html>|]
53</html>|]