Skip to content

Commit 0fd5b8f

Browse files
committed
.
1 parent 6821e40 commit 0fd5b8f

File tree

1 file changed

+61
-4
lines changed

1 file changed

+61
-4
lines changed

readme.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,67 @@ App must be mounted to a div, with id `app`.
3030

3131
CI builds a container image which is ready to roll.
3232

33-
## Example command
33+
## TL:DR
3434

35-
To run this from a shell, try something like this:
35+
```sh
36+
touch helloScalaJS.scala
37+
```
38+
39+
```scala
40+
41+
//> using scala 3.4.2
42+
//> using platform js
43+
44+
//> using dep org.scala-js::scalajs-dom::2.8.0
45+
//> using dep com.raquo::laminar::17.0.0
46+
47+
//> using jsModuleKind es
48+
//> using jsModuleSplitStyleStr smallmodulesfor
49+
//> using jsSmallModuleForPackage webapp
50+
51+
package webapp
52+
53+
import org.scalajs.dom
54+
import org.scalajs.dom.document
55+
import com.raquo.laminar.api.L.{*, given}
56+
57+
@main
58+
def main: Unit =
59+
renderOnDomContentLoaded(
60+
dom.document.getElementById("app"),
61+
interactiveApp
62+
)
63+
64+
def interactiveApp =
65+
val hiVar = Var("Wor")
66+
div(
67+
h1(
68+
s"This was more.scala",
69+
child.text <-- hiVar.signal
70+
),
71+
p("This asdf df"),
72+
// https://demo.laminar.dev/app/form/controlled-inputs
73+
input(
74+
typ := "text",
75+
controlled(
76+
value <-- hiVar.signal,
77+
onInput.mapToValue --> hiVar.writer
78+
)
79+
)
80+
)
81+
```
3682

3783
```sh
38-
cs launch io.github.quafadas:live-server-scala-cli-js_3:0.0.9 -- --project-dir /Users/simon/Code/viteless --port 3000 --build-tool scala-cli --out-dir /Users/simon/Code/viteless/out --browse-on-open-at /
39-
```
84+
cs launch io.github.quafadas:live-server-scala-cli-js_3:0.0.11
85+
```
86+
87+
The intention, is for the simple case to be zero configuration. The below invocation makes the following assumptions;
88+
89+
- cs (coursier) is on the path
90+
- You are using scala-cli and it is on the path
91+
- You are happy to serve your application on port 3000
92+
- You wish a browser window to open at the root of the application
93+
- You are invoking it from the root of a directory containing a valid scala JS project that is configured to use ES modules.
94+
- Your application, will mount in a div with id `app`.
95+
96+
The file above is a one file example of such a project, satisfying these constraints.

0 commit comments

Comments
 (0)