Skip to content

TylorS167/mostly-html

Repository files navigation

Mostly HTML

Creates HTML from mostly-dom VNode

Get it

yarn add mostly-html mostly-dom
# or
npm install --save mostly-html mostly-dom

API

toHtml(vNode: VNode): string

Given a VNode it returns a HTML string

import { div, button, h1 } from 'mostly-dom'
import { toHtml } from 'mostly-html'

const view = (amount: number) =>
  div({ className: 'foo' }, [
    button({ id: 'increment' }, 'Increment'),
    button({ id: 'decrement' }, 'Decrement'),
    h1(String(amount))
  ])

const html = toHtml(view(1))

console.log(html)
// => <div class="foo"><button id="increment">Increment</button><button id="decrement">Decrement</button><h1>1</h1></div>

About

Convert's mostly-dom VNode's into HTML strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published