Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stepanvanzuriak/picohtml

HTML template strings
https://github.com/stepanvanzuriak/picohtml

dom pico render template-string

Last synced: about 2 months ago
JSON representation

HTML template strings

Awesome Lists containing this project

README

        

Powerfully ~2kB (gzip) HTML template strings

# Installation

```bash
$ npm install picohtml
```

# Usage

```js
import { html, render } from "picohtml";

const el = html`

Hello planet

`;

render(el, document.body);
```

## Attaching event listeners

```js
import { html, render } from "picohtml";

const click = () => alert("Hello planet!");
const el = html`Click`;

render(el, document.body);
```

## Insert template literal and picohtml literal

```js
import { html, render, raw } from "picohtml";

const text = `

Text

`;
const htmlText = () => html`

HTML Text

`;
const el = html`
${text} ${raw(htmlText())}
`;

render(el, document.body);
```

## License

[MIT](./LICENSE)

## See Also

- [nanohtml](https://github.com/choojs/nanohtml)
- [lit-html](https://github.com/Polymer/lit-html)