|
2 | 2 |
|
3 | 3 | A chatbox client written in Svelte, to be paired with LiveMatrix Server binary |
4 | 4 |
|
| 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 | + |
5 | 37 | ## Configuration |
6 | 38 | Take the sample config and modify it according to your server configuration. |
7 | 39 |
|
@@ -42,4 +74,11 @@ lm_server.domain.com { |
42 | 74 | header_down Set-Cookie (.*) "$1; SameSite=None; Secure" |
43 | 75 | header_down Access-Control-Allow-Credentials "true" |
44 | 76 | } |
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