mirror of
https://codeberg.org/setop/elm-scripting
synced 2025-11-08 21:49:57 +00:00
feat: auto discover main module
This commit is contained in:
@@ -14,24 +14,24 @@ Next, we concatenate this with the Elm JavaScript output and an app launcher sni
|
||||
|
||||
* No event loop
|
||||
* Hence, no [TEA](https://guide.elm-lang.org/architecture/); the `main` function must return a static view
|
||||
* The Elm app module must be called "Main"
|
||||
* ~~The Elm app module must be called "Main"~~
|
||||
* Nodes can only have one parent (this should always be the case)
|
||||
|
||||
# Usage
|
||||
|
||||
1. Clone this repository and navigate into your local copy
|
||||
2. Run `elm init`.
|
||||
3. Create `src/Main.elm` with the following content:
|
||||
3. Create `src/Hello.elm` with the following content:
|
||||
|
||||
```elm
|
||||
module Main exposing(main)
|
||||
module Hello exposing(main)
|
||||
|
||||
import Html exposing (p, text)
|
||||
|
||||
main = p [] [text "Hello World!"]
|
||||
```
|
||||
|
||||
4. Run `./build.sh`; this generates the corresponding HTML code:
|
||||
4. Run `./build.sh src/Hello.elm`; this generates the corresponding HTML code:
|
||||
|
||||
```html
|
||||
<p>
|
||||
|
||||
2
build.sh
2
build.sh
@@ -2,7 +2,7 @@
|
||||
|
||||
w1="$(mktemp out_$$_1_XXXX.js)"
|
||||
|
||||
elm make --optimize --output=${w1} src/Main.elm 1>&2
|
||||
elm make --optimize --output=${w1} $1 1>&2
|
||||
|
||||
w2="$(mktemp out_$$_XXXX.js)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user