{"id":16625475,"url":"https://github.com/aleclarson/mini-hb","last_synced_at":"2025-09-16T03:32:22.534Z","repository":{"id":57297583,"uuid":"157606500","full_name":"aleclarson/mini-hb","owner":"aleclarson","description":"Tiny handlebars engine (made with TypeScript)","archived":false,"fork":false,"pushed_at":"2018-12-05T16:46:36.000Z","size":33,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T19:05:53.118Z","etag":null,"topics":["handlebars","mustache","rendering","templates","templating"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleclarson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-14T20:25:13.000Z","updated_at":"2021-12-25T11:10:36.000Z","dependencies_parsed_at":"2022-09-02T06:30:26.498Z","dependency_job_id":null,"html_url":"https://github.com/aleclarson/mini-hb","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fmini-hb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fmini-hb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fmini-hb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fmini-hb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleclarson","download_url":"https://codeload.github.com/aleclarson/mini-hb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233200426,"owners_count":18640370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["handlebars","mustache","rendering","templates","templating"],"created_at":"2024-10-12T04:05:49.578Z","updated_at":"2025-09-16T03:32:17.233Z","avatar_url":"https://github.com/aleclarson.png","language":"TypeScript","funding_links":["https://paypal.me/alecdotbiz"],"categories":[],"sub_categories":[],"readme":"# mini-hb\n\n[![npm](https://img.shields.io/npm/v/mini-hb.svg)](https://www.npmjs.com/package/mini-hb)\n[![Build status](https://travis-ci.org/aleclarson/mini-hb.svg?branch=master)](https://travis-ci.org/aleclarson/mini-hb)\n[![Coverage status](https://coveralls.io/repos/github/aleclarson/mini-hb/badge.svg?branch=master)](https://coveralls.io/github/aleclarson/mini-hb?branch=master)\n[![Bundle size](https://badgen.net/bundlephobia/min/mini-hb)](https://bundlephobia.com/result?p=mini-hb)\n[![Install size](https://packagephobia.now.sh/badge?p=mini-hb)](https://packagephobia.now.sh/result?p=mini-hb)\n[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)\n\nTypeScript successor to [mini-handlebars](https://www.npmjs.com/package/mini-handlebars)\n\n## Features\n\n- [~4kB](https://bundlephobia.com/result?p=mini-hb) minified (compared to [~70kB](https://bundlephobia.com/result?p=handlebars) minified [handlebars](http://npmjs.com/package/handlebars))\n- [~18kB](https://packagephobia.now.sh/result?p=mini-hb) install size (compared to [~5.8MB](https://packagephobia.now.sh/result?p=handlebars) with [handlebars](http://npmjs.com/package/handlebars))\n- tiny API\n- template pre-parsing\n- \"parse then render\" in one call\n- no batteries included (blocks are just local functions)\n- syntax/context plugin system **(coming later)**\n- 100% test coverage\n\n## Usage\n\n```ts\nimport {hb} from 'mini-hb'\n\n// Use an object literal to provide variables/functions to templates.\nlet context = {\n  foo: 'foo',\n  test(template, context) {\n    // `template` is what your block contains.\n    // `context` is the context your block has access to.\n    // The return value is coerced to a string (but undefined is ignored).\n    return hb(template, context)\n  },\n}\n\n// Render a template.\nlet template = '{{ foo }}{{ bar }}'\nlet result = hb(template, context)\n\n// Bind a template to `hb`\nlet render = hb.bind(template)\nresult = render(context) // \"foo\"\n\n// Bind a context to `hb`\nrender = hb.bind(context)\nresult = render(template) // \"foo\"\n\n// Bind many contexts to `hb`\nrender = hb.bind(context, { bar: 'bar' }, { foo: '' })\nresult = render(template) // \"bar\"\n\n// Merge contexts into a new context. (null and undefined are skipped)\ncontext = hb(context, { bar: 'bar' }, cond ? { foo: true } : null)\n```\n\nSee [the tests](/spec) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fmini-hb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleclarson%2Fmini-hb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fmini-hb/lists"}