0.0.3 • Published 6 months ago

arrow-render-to-string v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

npm.io npm.io

Render ArrowJS templates and partials to string.

Works wherever JS does.

Installation

npm install arrow-render-to-string

Usage/Examples

Basic

import { html } from '@arrow-js/core'
import { renderToString } from 'arrow-render-to-string'

const message = 'Hello World'
const view = html`<p>${message}</p>`

renderToString(view) //=> <p>Hello World</p>

Reactive Variables

import { html, reactive } from '@arrow-js/core'
import { renderToString } from 'arrow-render-to-string'

const state = reactive({
  count: 0,
})
const view = html`<p>${() => state.count}</p>`

renderToString(view) //=> <p>0</p>

Events

Events are stripped out, for you to re-hydrate on the client

import { html, reactive } from '@arrow-js/core'
import { renderToString } from 'arrow-render-to-string'

const state = reactive({
  count: 0,
})
const view = html`<button @click="${() => (state.count += 1)}">
  ${() => state.count}
</button>`

renderToString(view) //=> <button @click="<!--➳❍-->">0</button>

License

MIT

0.0.3

6 months ago

0.0.3-beta.0

6 months ago

0.0.3-beta.1

6 months ago

0.0.2

6 months ago

0.0.2-beta.0

7 months ago

0.0.1

7 months ago

0.0.1-beta.4

7 months ago

0.0.1-beta.3

7 months ago

0.0.1-beta.1

7 months ago