{"id":24083273,"url":"https://github.com/mitranim/statil","last_synced_at":"2026-06-23T03:32:12.453Z","repository":{"id":27835776,"uuid":"31325777","full_name":"mitranim/statil","owner":"mitranim","description":"Simple string templating with embedded JS","archived":false,"fork":false,"pushed_at":"2018-12-17T11:45:12.000Z","size":142,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-28T00:13:09.544Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitranim.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-25T17:17:45.000Z","updated_at":"2018-12-17T11:45:14.000Z","dependencies_parsed_at":"2022-09-26T16:21:45.351Z","dependency_job_id":null,"html_url":"https://github.com/mitranim/statil","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/mitranim/statil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Fstatil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Fstatil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Fstatil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Fstatil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitranim","download_url":"https://codeload.github.com/mitranim/statil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Fstatil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"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":[],"created_at":"2025-01-09T23:56:15.525Z","updated_at":"2026-06-23T03:32:12.431Z","avatar_url":"https://github.com/mitranim.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nTemplating function, very similar to `lodash/template`. Embeds JavaScript into templates.\n\nLightweight: \u003c 100 lines of code, dependency-free.\n\nDifferences from `lodash/template`:\n\n  * doesn't carry the entire Lodash with it\n  * always strict mode\n  * no `with`, no implicit globals, no imports\n  * better default delimiters: `{{ expression }}` and `\u003c\u003c statement \u003e\u003e`\n  * no special escape delimiter, escape manually\n  * better option naming\n  * slightly more readable compiled code\n\nStatil is intended for templates that embed JS. For the _opposite_, when you want to write templates primarily in JavaScript, using JSX, see the spiritually related library [Papyre](https://github.com/mitranim/papyre).\n\n## Why\n\nSimple templating. Extremely flexible. Extremely lightweight.\n\nAlternatives tend to involve monstrously large dependencies like Lodash.\n\n## Usage\n\nShort form:\n\n```js\nconst {compileTemplate} = require('statil')\n\ncompileTemplate(`Hello {{$.name}}!`)({name: 'world'})\n// 'Hello world!'\n```\n\nLong form:\n\n```js\nconst {compileTemplate} = require('statil')\n\nconst templateStr = `Hello {{$.name}}!`\n\n// Optional settings\nconst options = void {\n  expressionRegexp: /{{\\s*([\\s\\S]+?)\\s*}}/g,\n  statementRegexp: /\u003c\u003c\\s*([\\s\\S]+?)\\s*\u003e\u003e/g,\n  contextName: '$',\n}\n\nconst template = compileTemplate(templateStr, options)\n\ntemplate({name: 'world'})\n// 'Hello world!'\n```\n\nFor control flow, use `\u003c\u003c statements \u003e\u003e`:\n\n```js\nconst templateStr = `\n\u003c\u003c for (const name of $.names) { \u003e\u003e {{name}} \u003c\u003c } \u003e\u003e\n`\n\ncompileTemplate(templateStr)({names: ['one', 'two', 'three']})\n//  one  two  three\n```\n\n## Misc\n\nI'm receptive to suggestions. If this library _almost_ satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitranim%2Fstatil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitranim%2Fstatil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitranim%2Fstatil/lists"}