@@ -65,9 +65,8 @@ The file above is a one file example of such a project, satisfying these constra
6565
6666The dream, is for the CLI to be flexible enough to accomodate more complex scenarios as well.
6767
68- ``` sh
69- simon@Simons-Mac-mini cwazy % cs launch io.github.quafadas:live-server-scala-cli-js_3:0.0.10 -- --help
70- Usage: LiveServer [--project-dir < string> ] [--out-dir < string> ] [--styles-dir < string> ] [--port < integer> ] [--proxy-target-port < integer> ] [--proxy-prefix-path < string> ] [--log-level < string> ] --build-tool < string> [--browse-on-open-at < string> ] [--extra-build-args < string> ]... [--mill-module-name < string> ] [--path-to-index-html-template < string> ]
68+ ```
69+ Usage: LiveServer [--project-dir <string>] [--out-dir <string>] [--port <integer>] [--proxy-target-port <integer>] [--proxy-prefix-path <string>] [--log-level <string>] [--build-tool <string>] [--browse-on-open-at <string>] [--extra-build-args <string>]... [--mill-module-name <string>] [--path-to-index-html <string>] [--styles-dir <string>]
7170
7271Scala JS live server
7372
@@ -79,17 +78,15 @@ Options and flags:
7978 --project-dir <string>
8079 The fully qualified location of your project - e.g. c:/temp/helloScalaJS
8180 --out-dir <string>
82- Where the compiled JS will be compiled to - e.g. c:/temp/helloScalaJS/.out
83- --styles-dir < string>
84- A fully qualified path to your styles directory with LESS files in - e.g. c:/temp/helloScalaJS/styles
81+ Where the compiled JS will be compiled to - e.g. c:/temp/helloScalaJS/.out. If no file is given, a temporary directory is created.
8582 --port <integer>
8683 The port you want to run the server on - e.g. 3000
8784 --proxy-target-port <integer>
8885 The port you want to forward api requests to - e.g. 8080
8986 --proxy-prefix-path <string>
9087 Match routes starting with this prefix - e.g. /api
9188 --log-level <string>
92- The log level (e.g. info, debug, error, trace)
89+ The log level. info, debug, error, trace
9390 --build-tool <string>
9491 scala-cli or mill
9592 --browse-on-open-at <string>
@@ -98,6 +95,10 @@ Options and flags:
9895 Extra arguments to pass to the build tool
9996 --mill-module-name <string>
10097 Extra arguments to pass to the build tool
98+ --path-to-index-html <string>
99+ a path to a directory which contains index.html. The entire directory will be served as static assets
100+ --styles-dir <string>
101+ A fully qualified path to your styles directory with LESS files in - e.g. c:/temp/helloScalaJS/styles
101102```
102103
103104To be minimally viable for me personally,
@@ -138,4 +139,22 @@ App must be mounted to a div, with id `app`.
138139
139140## Contributing
140141
141- CI builds a container image which is ready to roll.
142+ CI builds a container image which is ready to roll.
143+
144+ ## Providing your own HTML
145+
146+ You'll need to make sure it includes this script. Otherwise no reload on change.
147+
148+ ``` html
149+ <script >
150+ const sse = new EventSource (" /api/v1/sse" );
151+ sse .addEventListener (" message" , (e ) => {
152+ const msg = JSON .parse (e .data );
153+
154+ if (" KeepAlive" in msg) console .log (" KeepAlive" );
155+
156+ if (" PageRefresh" in msg) location .reload ();
157+ });
158+ </script >
159+
160+ ```
0 commit comments