Skip to content

Commit 8ade7b8

Browse files
committed
paperwork
1 parent f073292 commit 8ade7b8

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MIT License
2+
3+
Copyright (c) 2023 reaper (https://reaper.is) <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
11
# arrow-render-to-string
22

3-
Utils to use arrow-js to render and hydrate from a server rendered environment
3+
Render [ArrowJS](http://arrow-js.com) templates and partials to string.
4+
5+
Works wherever JS does.
6+
7+
## Installation
8+
9+
```bash
10+
npm install arrow-render-to-string
11+
```
12+
13+
## Usage/Examples
14+
15+
### Basic
16+
17+
```javascript
18+
import { html } from '@arrow-js/core'
19+
import { renderToString } from 'arrow-render-to-string'
20+
21+
const message = 'Hello World'
22+
const view = html`<p>${message}</p>`
23+
24+
renderToString(view) //=> <p>Hello World</p>
25+
```
26+
27+
### Reactive Variables
28+
29+
```javascript
30+
import { html, reactive } from '@arrow-js/core'
31+
import { renderToString } from 'arrow-render-to-string'
32+
33+
const state = reactive({
34+
count: 0,
35+
})
36+
const view = html`<p>${() => state.count}</p>`
37+
38+
renderToString(view) //=> <p>0</p>
39+
```
40+
41+
### Events
42+
43+
Events are stripped out, for you to re-hydrate on the client
44+
45+
```javascript
46+
import { html, reactive } from '@arrow-js/core'
47+
import { renderToString } from 'arrow-render-to-string'
48+
49+
const state = reactive({
50+
count: 0,
51+
})
52+
const view = html`<button @click="${() => (state.count += 1)}">
53+
${() => state.count}
54+
</button>`
55+
56+
renderToString(view) //=> <button @click="<!--➳❍-->">0</button>
57+
```
58+
59+
## License
60+
61+
[MIT](/LICENSE)

0 commit comments

Comments
 (0)