Skip to main content

Built and signed on GitHub Actions

Tiny html tag function for no-build JSX-like syntax, compatible with all modern browsers and runtimes.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 months ago (1.0.1)

@rbardini/html

JSR JSR Score

Tiny html tag function for no-build JSX-like syntax, compatible with all modern browsers and runtimes.

import { html } from '@rbardini/html'

const heading = ({ level = 1, children }) =>
  html`<h${level}>${children}</h${level}>`

const list = ({ title, items }) =>
  html`
    ${title && heading(title)}
    <ul>
      ${items.map((item) => html`<li>${item}</li>`)}
    </ul>
  `

Inspired by jimniels/html.

Usage

# Deno
deno add @rbardini/html

# npm (one of the below, depending on your package manager)
npx jsr add @rbardini/html
yarn dlx jsr add @rbardini/html
pnpm dlx jsr add @rbardini/html
bunx jsr add @rbardini/html

Or copy-paste the contents of mod.ts.

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@rbardini/html

Import symbol

import * as html from "@rbardini/html";

---- OR ----

Import directly with a jsr specifier

import * as html from "jsr:@rbardini/html";

Add Package

npx jsr add @rbardini/html

Import symbol

import * as html from "@rbardini/html";

Add Package

yarn dlx jsr add @rbardini/html

Import symbol

import * as html from "@rbardini/html";

Add Package

pnpm dlx jsr add @rbardini/html

Import symbol

import * as html from "@rbardini/html";

Add Package

bunx jsr add @rbardini/html

Import symbol

import * as html from "@rbardini/html";