{"id":13630057,"url":"https://github.com/lukeed/tempura","last_synced_at":"2025-04-11T23:16:08.477Z","repository":{"id":41858296,"uuid":"320194054","full_name":"lukeed/tempura","owner":"lukeed","description":"A light, crispy, and delicious template engine 🍤","archived":false,"fork":false,"pushed_at":"2024-07-12T21:24:52.000Z","size":111,"stargazers_count":534,"open_issues_count":12,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T23:16:02.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/lukeed.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license","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},"funding":{"github":"lukeed"}},"created_at":"2020-12-10T07:30:42.000Z","updated_at":"2025-03-18T11:18:18.000Z","dependencies_parsed_at":"2024-08-01T22:52:16.648Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/tempura","commit_stats":{"total_commits":95,"total_committers":1,"mean_commits":95.0,"dds":0.0,"last_synced_commit":"e1c6a38da65876751b54a26d8a6371d6cf587459"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Ftempura","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Ftempura/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Ftempura/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Ftempura/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/tempura/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492884,"owners_count":21113163,"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":[],"created_at":"2024-08-01T22:01:28.740Z","updated_at":"2025-04-11T23:16:08.452Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lukeed"],"categories":["JavaScript","Packages"],"sub_categories":["Template engines"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"tempura\" height=\"190\" /\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/tempura\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/v/tempura\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/lukeed/tempura\"\u003e\n    \u003cimg src=\"https://github.com/lukeed/tempura/workflows/CI/badge.svg\" alt=\"CI\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://licenses.dev/npm/tempura\"\u003e\n    \u003cimg src=\"https://licenses.dev/b/npm/tempura\" alt=\"licenses\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.org/package/tempura\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/npm/dm/tempura\" alt=\"downloads\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/lukeed/tempura\"\u003e\n    \u003cimg src=\"https://badgen.now.sh/codecov/c/github/lukeed/tempura\" alt=\"codecov\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003eA light, crispy, and delicious template engine 🍤\u003c/div\u003e\n\n## Features\n\n* **Extremely lightweight**\u003cbr\u003e\n  _Everything is `1.26 kB` (gzip) – even less with tree-shaking!_\n\n* **Super Performant**\u003cbr\u003e\n  _Significantly [faster](#benchmarks) than the big names; and the small ones._\n\n* **Familiar Syntax**\u003cbr\u003e\n  _Tempura templates look great with Handlebars syntax highlighting._\n\n* **Custom Directives**\u003cbr\u003e\n  _Easily define [custom blocks](/docs/blocks.md), via the [API](/docs/api.md), to extend functionality._\n\n## Install\n\n```\n$ npm install --save tempura\n```\n\n## Usage\n\n\u003e Visit the [`/examples`](/examples) and [Syntax Cheatsheet](/docs/syntax.md) for more info!\n\n***example.hbs***\n\n```hbs\n{{! expected props to receive }}\n{{#expect title, items }}\n\n{{! inline variables }}\n{{#var count = items.length }}\n{{#var suffix = count === 1 ? 'task' : 'tasks' }}\n\n{{#if count == 0}}\n  \u003cp\u003eYou're done! 🎉\u003c/p\u003e\n{{#else}}\n  \u003cp\u003eYou have {{{ count }}} {{{ suffix }}} remaining!\u003c/p\u003e\n\n  {{#if count == 1}}\n    \u003csmall\u003eAlmost there!\u003c/small\u003e\n  {{#elif count \u003e 10}}\n    \u003csmall\u003e... you must be \u003cem\u003efried\u003c/em\u003e 😔\u003c/small\u003e\n  {{#else}}\n    \u003csmall\u003eYou've got this 💪🏼\u003c/small\u003e\n  {{/if}}\n\n  \u003cul\u003e\n    {{#each items as todo}}\n      \u003cli\u003e{{ todo.text }}\u003c/li\u003e\n    {{/each}}\n  \u003c/ul\u003e\n{{/if}}\n```\n\n***render.js***\n\n```js\nimport { readFile } from 'fs/promises';\nimport { transform, compile } from 'tempura';\n\nconst template = await readFile('example.hbs', 'utf8');\n\n// Transform the template into a function\n// NOTE: Produces a string; ideal for build/bundlers\n// ---\n\nlet toESM = transform(template);\nconsole.log(typeof toESM); //=\u003e \"string\"\nconsole.log(toESM);\n//=\u003e `import{esc as $$1}from\"tempura\";export default function($$3,$$2){...}`\n\nlet toCJS = transform(template, { format: 'cjs' });\nconsole.log(typeof toCJS); //=\u003e \"string\"\nconsole.log(toCJS);\n//=\u003e `var $$1=require(\"tempura\").esc;module.exports=function($$3,$$2){...}`\n\n\n// Convert the template into a live function\n// NOTE: Produces a `Function`; ideal for runtime/servers\n// ---\n\nlet render = compile(template);\nconsole.log(typeof render); //=\u003e \"function\"\nrender({\n  title: 'Reminders',\n  items: [\n    { id: 1, text: 'Feed the doggo' },\n    { id: 2, text: 'Buy groceries' },\n    { id: 3, text: 'Exercise, ok' },\n  ]\n});\n//=\u003e \"\u003cp\u003eYou have 3 tasks remaining!\u003c/p\u003e\\n\"\n//=\u003e + \"\u003csmall\u003eYou've got this 💪🏼\u003c/small\u003e\\n\\n\"\n//=\u003e + \"\u003cul\u003e\\n\"\n//=\u003e + \"  \u003cli\u003eFeed the doggo\u003c/li\u003e\\n\"\n//=\u003e + \"  \u003cli\u003eBuy groceries\u003c/li\u003e\\n\"\n//=\u003e + \"  \u003cli\u003eExercise, ok\u003c/li\u003e\\n\"\n//=\u003e + \"\u003c/ul\u003e\"\n```\n\n## Syntax\n\nPlease refer to the [Syntax Cheatsheet](/docs/syntax.md).\n\n\n## API\n\nVisit the [API](/docs/api.md) and [Custom Blocks](/docs/blocks.md) for documentation.\n\n\n## Benchmarks\n\n\u003e Running via Node v14.15.13\n\nPlease visit the [`/bench`](/bench) directory for complete, reproducible benchmarks.\n\nThe following is a subset of the full results, presented without context. Again, please visit [`/bench`](/bench) for explanations, comparisons, and/or differences.\n\n```\nBenchmark: Render w/ raw values (no escape)\n  pug                x 34,847 ops/sec ±2.79% (93 runs sampled)\n  handlebars         x  6,700 ops/sec ±1.41% (92 runs sampled)\n  ejs                x    802 ops/sec ±0.54% (94 runs sampled)\n  dot                x 40,704 ops/sec ±3.08% (93 runs sampled)\n  art-template       x 39,839 ops/sec ±0.86% (90 runs sampled)\n  tempura            x 44,656 ops/sec ±0.42% (92 runs sampled)\n\nBenchmark: Render w/ escaped values\n  pug                x 2,800 ops/sec ±0.31% (95 runs sampled)\n  handlebars         x   733 ops/sec ±0.34% (94 runs sampled)\n  ejs                x   376 ops/sec ±0.17% (91 runs sampled)\n  dot                x   707 ops/sec ±0.15% (96 runs sampled)\n  art-template       x 2,707 ops/sec ±0.12% (96 runs sampled)\n  tempura            x 2,922 ops/sec ±0.31% (96 runs sampled)\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Ftempura","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Ftempura","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Ftempura/lists"}