npm

picohtml
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

Powerfully ~2kB (gzip) HTML template strings

Installation

$ npm install picohtml

Usage

import { html, render } from "picohtml";

const el = html`<h1>Hello planet</h1>`;

render(el, document.body);

Attaching event listeners

import { html, render } from "picohtml";

const click = () => alert("Hello planet!");
const el = html`<button onclick=${click}>Click</button>`;

render(el, document.body);

Insert template literal and picohtml literal

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

const text = `<p>Text</p>`;
const htmlText = () => html`<p>HTML Text</p>`;
const el = html`<div>${text} ${raw(htmlText())}</div>`;

render(el, document.body);

License

MIT

See Also

Package Sidebar

Install

npm i picohtml

Weekly Downloads

5

Version

0.1.8

License

MIT

Unpacked Size

14.6 kB

Total Files

16

Last publish

Collaborators

  • stepanvanzuriak