Skip to content

Commit 077cfdc

Browse files
committed
Improve the Readme
1 parent d5c11f2 commit 077cfdc

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
22

33
A chatbox client written in Svelte, to be paired with LiveMatrix Server binary
44

5+
## Installation
6+
Place the `.css` and `.js` files in the static files hosting directory of your application.
7+
Attach the `.css` and `.js` files as part of your application. It is a good idea to place the CSS in the head of the application and JS at the end of the body.
8+
```html
9+
<head>
10+
<link rel="stylesheet" href="/livematrix/livematrix.css">
11+
</head>
12+
<body>
13+
...
14+
<script type="module" src="/livematrix/livematrix.js"></script>
15+
</body>
16+
```
17+
In your application, create a `span` element with id=`livematrix`.
18+
```
19+
<span id="livematrix" style="display: contents"></span>
20+
```
21+
and we are done!
22+
23+
### Install as svelte component
24+
Create a `LiveMatrix.svelte` component, as part of your Svelte application.
25+
_If you have placed the `.js` and `.css` files directly in the `static` directory._
26+
In this component add lines:
27+
```
28+
<svelte:head>
29+
<script type="module" src="/livematrix.min.js"></script>
30+
<link rel="stylesheet" href="/livematrix.css" />
31+
</svelte:head>
32+
33+
<span id="livematrix" style="display: contents"></span>
34+
```
35+
then import this component to any part of your website and see the chatbox appear!
36+
537
## Configuration
638
Take the sample config and modify it according to your server configuration.
739

@@ -42,4 +74,11 @@ lm_server.domain.com {
4274
header_down Set-Cookie (.*) "$1; SameSite=None; Secure"
4375
header_down Access-Control-Allow-Credentials "true"
4476
}
45-
}
77+
}
78+
79+
## Building
80+
To make a standalone application, we can use the command attached to `package.json`
81+
```
82+
pnpm run standalone
83+
```
84+
which is going to make separate, minified .js and .css files, to be included as part of our website.

0 commit comments

Comments
 (0)