npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

html6

v0.7.2

Published

High-performance HTML templating library for Node.js

Readme

HTML6

HTML6 is a fast, modern templating language designed to extend static HTML5 with dynamic logic, without sacrificing performance or compatibility.

It compiles HTML templates into native JavaScript template literal functions—ideal for server-rendered apps and frameworks where you want full control over output and performance.


Features

  • Compiles to native JavaScript template literal functions
  • Native-level performance, minimal overhead
  • Server-side by design, works in browsers too
  • Integrates with Web Components, HTMX, and all libraries
  • Use valid .html files directly, no build required
  • Fully supports Prettier, linters, and standard tooling
  • Extendable via custom components and tag replacement
  • Control logic via attributes: if, elsif, else, map
  • Expressions via {{...}}
  • Pipes with |> operator for safe expression transformation
  • Works with Node.js, Bun, Deno
  • Tiny footprint, nearly zero dependencies

Install

npm i html6

Basic Usage

var html6 = require('html6')

var renderer = html6.compile('<h1>Hello</h1>')
var result = renderer.render({})
// Outputs: <h1>Hello</h1>

Expressions

Use {{...}} to output scoped data.

<h1>{{title}}</h1>
<p>{{project.name}}</p>

Escape literal brackets:

\{{not evaluated}}

Function calls inside {{...}} are disabled for security. Use pipes instead.


Pipes

Use |> to transform values.

Built-in:

{{value |> esc}}

Custom pipes:

var pipes = {
  truncate: function (x, len) {
    return String(x).slice(0, len)
  },
  upper: function (x) {
    return String(x).toUpperCase()
  }
}

var renderer = html6.compile('<p>{{title |> upper}}</p>', { pipes: pipes })

Pipe Examples

{{value |> esc |> truncate 2}}
{{name |> upper}}
{{msg |> truncate 10}}
{{price |> formatCurrency}}
{{number |> toFixed 2}}
{{date |> formatDate 'YYYY-MM-DD'}}
{{user.name |> upper |> truncate 5}}
{{list.length |> esc}}
{{value |> round 1 |> multiply 10}}
{{filename |> split '.' |> last}}

Components

Define components with <template is="...">:

<template is="card">
  <div class="card">
    <slot></slot>
  </div>
</template>

Use them like native tags:

<card>
  <p>Hello from slot</p>
</card>

Component Slots

Use <slot></slot> inside a component:

<template is="box">
  <div class="box">
    <slot></slot>
  </div>
</template>
<box><div>content</div></box>

Component Props

Pass static, interpolated, or dynamic props:

<template is="card">{{props.title}}</template>

Examples:

<card title="hello"></card>
<card title="{{value}}"></card>
<card title="Hi {{user.name}}"></card>
<card title="{{42}}"></card>
<card title="{{true}}"></card>
<card title="{{price + ' USD'}}"></card>
<card title="Total: {{count * unitPrice}}"></card>

Conditionals

Use control attributes on elements:

<div if="loggedIn">Welcome back</div>
<div elsif="pending">Pending...</div>
<div else>Please log in</div>

Each condition must be a valid JavaScript expression.


Map

Use map to loop arrays. Syntax: map="item of items" or map="item, i of items"

<ul>
  <li map="item of items">{{item.name}}</li>
</ul>

With index:

<ul>
  <li map="item, i of items">{{i}}: {{item.name}}</li>
</ul>

With condition:

<ul>
  <li map="p of projects" if="p.title.length > 0">{{p.title}}</li>
</ul>

Nested maps:

<div map="group of groups">
  <h2>{{group.name}}</h2>
  <ul>
    <li map="item of group.items">{{item}}</li>
  </ul>
</div>

Comparison

| Feature | HTML6 | EJS | Pug | Handlebars | JSX | | -------------------- | ----- | --- | --- | ---------- | --- | | Valid .html | ✅ | ❌ | ❌ | ❌ | ❌ | | Native JS output | ✅ | ✅ | ✅ | ❌ | ✅ | | Fastest execution | ✅ | ❌ | ❌ | ❌ | ❌ | | Components + Slots | ✅ | ❌ | ❌ | ❌ | ✅ | | Pipe support | ✅ | ❌ | ❌ | ❌ | ❌ | | No build step needed | ✅ | ✅ | ❌ | ✅ | ❌ | | Tooling-compatible | ✅ | ✅ | ❌ | ❌ | ✅ |


License

ISC