Registry / devops / hbt
library1.0.0jsnpmunverified

hbt is an HTML bundler and template engine designed to simplify HTML development with template inheritance, partials, and minification. The current stable version is 1.0.0. It offers a lightweight alternative to heavier build tools like Webpack or Gulp for HTML-specific tasks, with built-in minification and a simple syntax. Releases are on an as-needed cadence via npm.

npm install hbt
INSTALL
IMPORT
SIG · HBT
H
hbt
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

hbt
import hbt from 'hbt'
const hbt = require('hbt')
Package is ESM-only; CommonJS require() will fail.
compile
import { compile } from 'hbt'
import compile from 'hbt/compile'
compile is a named export, not a default export from a subpath.
render
import { render } from 'hbt'
const { render } = require('hbt')
Use ESM import; CJS destructuring will not work.

Demonstrates basic usage: read a template, compile it, render with data, and write output.

import hbt from 'hbt'; import { compile, render } from 'hbt'; import { readFileSync, writeFileSync } from 'fs'; const template = readFileSync('template.html', 'utf-8'); const compiled = compile(template); const html = render(compiled, { title: 'Hello', items: [1, 2, 3] }); writeFileSync('output.html', html); console.log('Done');
Debug
Known issues
gotchaESM-only package: require() will throw MODULE_NOT_FOUND. Use import syntax.
fix
Use ES module imports (import hbt from 'hbt') and ensure package.json has "type": "module" or use .mjs extension.
affects: >=1.0.0
gotchacompile() expects a string; passing a Buffer or file descriptor will cause type error.
fix
Always pass a UTF-8 string to compile(). Use readFileSync with 'utf-8' encoding.
affects: >=1.0.0
gotcharender() requires the second argument (data object) to be a plain object; non-object or null will throw.
fix
Always pass an object (even empty object {}) as data parameter.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/hbt/index.js from /path/to/script.js not supported.
Using CommonJS require() to import an ESM-only package.
fix
Change to dynamic import() or convert your project to ESM (e.g., add "type": "module" in package.json).
TypeError: template.readFileSync is not a function
Misunderstanding of compile() input – passing a file path instead of template string.
fix
Read the file contents with readFileSync first, then pass the string to compile().
TypeError: Cannot read properties of undefined (reading 'toString')
render() called with an undefined or null data object.
fix
Ensure render() second argument is an object (e.g., render(compiled, {})).
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
packagehbt
hbt — npm install hbt · libregistry