{"id":14986789,"url":"https://github.com/luwes/hyperstache","last_synced_at":"2025-09-04T22:32:17.559Z","repository":{"id":40784080,"uuid":"215926911","full_name":"luwes/hyperstache","owner":"luwes","description":"👨‍🦰 Handlebars just got a trim, alternative JS template engine, 2kb gzip","archived":false,"fork":false,"pushed_at":"2024-07-15T21:11:15.000Z","size":940,"stargazers_count":39,"open_issues_count":20,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T08:23:40.078Z","etag":null,"topics":["handlebars","mustache","tagged-template","template-literals"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luwes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-18T02:40:00.000Z","updated_at":"2023-10-28T15:25:06.000Z","dependencies_parsed_at":"2024-09-25T00:31:18.502Z","dependency_job_id":null,"html_url":"https://github.com/luwes/hyperstache","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":"0.17021276595744683","last_synced_commit":"bcc04436c6e981f7190080e9bc741043d83eff90"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/luwes/hyperstache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fhyperstache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fhyperstache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fhyperstache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fhyperstache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luwes","download_url":"https://codeload.github.com/luwes/hyperstache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luwes%2Fhyperstache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273684696,"owners_count":25149717,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","tagged-template","template-literals"],"created_at":"2024-09-24T14:13:33.291Z","updated_at":"2025-09-04T22:32:12.421Z","avatar_url":"https://github.com/luwes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hyperstache\n\n[![Build Status](https://img.shields.io/travis/com/luwes/hyperstache/master.svg?style=flat-square\u0026label=Travis+CI)](https://travis-ci.com/luwes/hyperstache)\n![Badge size](https://img.badgesize.io/https://unpkg.com/hyperstache/dist/hyperstache.min.js?compression=gzip\u0026label=gzip\u0026style=flat-square)\n[![codecov](https://img.shields.io/codecov/c/github/luwes/hyperstache.svg?style=flat-square)](https://codecov.io/gh/luwes/hyperstache)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nLogic-less templates to template literals transformer.  \nHyperstache includes a full parser and runtime.  \nIt uses no `eval` and minimal regex for the best performance.  \nIt's largely compatible with [Handlebars](https://github.com/wycats/handlebars.js/) and [Mustache](https://github.com/janl/mustache.js/) templates.\n\n**npm**: `npm install hyperstache --save`  \n**cdn**: https://unpkg.com/hyperstache  \n**module**: https://unpkg.com/hyperstache?module\n\n## Why?\n\nThe goal is to make projects invested in Handlebars templates adopt a tagged templates only solution easily or add an additional layer of logic-less templates on top of any tagged template library.\n\n- [Sinuous](https://github.com/luwes/sinuous/) ([CodeSandbox](https://codesandbox.io/s/hyperstache-sinuous-5j4u9))\n- [htm](https://github.com/developit/htm) ([CodeSandbox](https://codesandbox.io/s/hyperstache-htm-ju83x))\n- [Lighterhtml](https://github.com/WebReflection/lighterhtml) ([CodeSandbox](https://codesandbox.io/s/hyperstache-lighterhtml-qnesy))\n- [lit-html](https://github.com/Polymer/lit-html) ([CodeSandbox](https://codesandbox.io/s/hyperstache-lithtml-xip2v))\n\n## `hyperstache` by the numbers:\n\n🚙 **2.07kB** when used directly in the browser\n\n🏍 **1.74kB** `hyperstache/mini` version ~~(built-in helpers)~~\n\n🏎 **1.07kB** if compiled using [babel-plugin-hyperstache](./packages/babel-plugin-hyperstache)\n\n## Features\n\n- [x] variables `{{escaped}}`, `{{{unescaped}}}`\n- [x] variables dot notation `{{obj.prop}}`\n- [x] helpers `{{loud lastname}}`\n- [x] helpers literal arguments: `numbers`, `strings`, `true`, `false`, `null` and `undefined`\n- [x] basic block helpers `{{#bold}}`\n- [x] built-in helpers: `if`, `unless`, `each`, `with`\n- [x] helper hash arguments\n- [x] comments `{{!comment}}`, `{{!-- comment with }} --}}`\n- [x] whitespace control `{{~ trimStart }}`\n- [ ] helper block parameters\n- [ ] subexpressions\n- [ ] partials `{{\u003epartial}}` \n\n## Usage ([CodeSandbox](https://codesandbox.io/s/boring-breeze-y3od0))\n\n```js\nimport { compile } from \"hyperstache\";\n\nconst o = (...args) =\u003e args;\nconst template = compile.bind(o)`\n  \u003cp\u003e\n    Hello, my name is {{name}}. \n    I am from {{hometown}}. I have {{kids.length}} kids:\n  \u003c/p\u003e\n  \u003cul\u003e\n    {{#each kids}}\n      \u003cli\u003e{{name}} is {{age}}\u003c/li\u003e\n    {{/kids}}\n  \u003c/ul\u003e\n`;\n\nconst data = {\n  name: \"Alan\",\n  hometown: \"Somewhere, TX\",\n  kids: [{ name: \"Jimmy\", age: \"12\" }, { name: \"Sally\", age: \"4\" }]\n};\nconsole.log(template(data));\n\n/** =\u003e\n[\n  [\n    \"\u003cp\u003e↵    Hello, my name is \",\n    \". ↵    I am from \",\n    \". I have \",\n    \" kids:↵  \u003c/p\u003e↵  \u003cul\u003e\",\n    \"\u003c/ul\u003e\"\n  ],\n  \"Alan\",\n  \"Somewhere, TX\",\n  2,\n  [\n    [\"\", \"\", \"\"],\n    [\n      [\"\u003cli\u003e\", \" is \", \"\u003c/li\u003e\"],\n      \"Jimmy\",\n      \"12\"\n    ],\n    [\n      [\"\u003cli\u003e\", \" is \", \"\u003c/li\u003e\"],\n      \"Sally\",\n      \"4\"\n    ]\n  ]\n]\n */\n```\n\n## API\n\n`compile(statics, ...exprs)`\n\n`registerHelper(name, fn)`\n\n`escapeExpression(str)`\n\n`new SafeString(htmlStr)`\n\n## Real world ([CodeSandbox](https://codesandbox.io/s/damp-wave-5j4u9))\n\n```js\nimport { html } from \"sinuous\";\nimport { compile } from \"hyperstache\";\n\nconst template = compile.bind(html)`\n  \u003cp\u003e\n    Hello, my name is {{name}}. \n    I am from {{hometown}}. I have {{kids.length}} kids:\n  \u003c/p\u003e\n  \u003cul\u003e\n    {{#each kids}}\n      \u003cli\u003e{{name}} is {{age}}\u003c/li\u003e\n    {{/kids}}\n  \u003c/ul\u003e\n`;\n\nconst data = {\n  name: \"Alan\",\n  hometown: \"Somewhere, TX\",\n  kids: [{ name: \"Jimmy\", age: \"12\" }, { name: \"Sally\", age: \"4\" }]\n};\nconst dom = template(data);\ndocument.body.append(dom);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluwes%2Fhyperstache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluwes%2Fhyperstache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluwes%2Fhyperstache/lists"}