{"id":24663946,"url":"https://github.com/sujalchoudhari/solarstache","last_synced_at":"2026-05-05T18:38:53.403Z","repository":{"id":149511167,"uuid":"621378664","full_name":"SujalChoudhari/Solarstache","owner":"SujalChoudhari","description":"A simple and fast Template Engine for html.","archived":false,"fork":false,"pushed_at":"2023-04-02T16:02:53.000Z","size":23,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T05:17:31.684Z","etag":null,"topics":["html-template-engine","html-templating","mustache-templating","templating-engine"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sujalchoudhari/solarstache","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/SujalChoudhari.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-30T14:42:24.000Z","updated_at":"2023-03-31T06:06:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5b84b83-96a1-4e18-8493-3daec0f72a6d","html_url":"https://github.com/SujalChoudhari/Solarstache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SujalChoudhari/Solarstache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FSolarstache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FSolarstache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FSolarstache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FSolarstache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SujalChoudhari","download_url":"https://codeload.github.com/SujalChoudhari/Solarstache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SujalChoudhari%2FSolarstache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32663429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["html-template-engine","html-templating","mustache-templating","templating-engine"],"created_at":"2025-01-26T05:17:28.323Z","updated_at":"2026-05-05T18:38:53.397Z","avatar_url":"https://github.com/SujalChoudhari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\n# Solarstache\n\nSolarstache is a zero-dependency templating engine for TypeScript. It's a logic-based engine that's not based on a template language like Handlebars or Mustache, but rather on a logic language like JavaScript. With Solarstache, you can write JavaScript code to implement logic, making it a perfect choice for developers who prefer direct code implementation.\n\nBecause of the direct JavaScript code implementation, processing with Solarstache is faster than other template engines. (Yeah, that's right, it's faster than a rocket-powered cheetah!)\n\nThe code for Solarstache was inspired by an article that was written on a sunny day by a programmer with a great mustache. (That's right, we take mustaches very seriously around here!)\n\n## Where can I use it?\n\nSolarstache is a minimalistic template engine, which means it's not a full-fledged framework. It's a tool that can be used in any framework or library. Whether you're building an app in React, Angular, Vue, or any other framework, Solarstache can be easily integrated with your existing codebase.\n\nWhen you need some templating functionality but don't want to use an entire templating framework with a large code base (we all have been there, right?), Solarstache is the right choice. It's like a Swiss Army knife for your templating needs, compact and efficient.\n\nSo, why settle for less when you can have Solarstache in your toolkit? Try it out today! (Your mustache will thank you for it!)\n\n\n\n\n\n## Installation\nDownload the [Repository](https://github.com/SujalChoudhari/Solarstache.git)\n\nOR\n\nCopy the `index.js` file from the `dist` folder. (for javascript)\nCopy the `index.ts` file from the `src` folder. (for typescript)\n\nOR\n\nInstall it using npm\n```bash\nnpm i @sujalchoudhari/solarstache\n```\n\nOR \nInstall it using yarn\n```bash\nyarn add @sujalchoudhari/solarstache\n```\n\n## Usage\n```ts\nvar {Solarstache} = require(\"@sujalchoudhari/solarstache\");\n// OR import { Solarstache } from \"@sujalchoudhari/solarstache\";\n\n\nconst view = {\n  title: \"Sujal\",\n  calc: \"$100\"\n};\n\nconst output = Solarstache.render(\"\u003c\u003c=props.title\u003e\u003e spends \u003c\u003cprops.calc\u003e\u003e\", view);\n```\n\nIn this example, the `view` object is passed to the `render` function.\nThe `view` object is used to replace the variables in the template.\n\n## Syntax\nThe syntax of Solarstache is very simple.\nIt is mix of Mustache and Html.\nFor accessing the variables, you can use `\u003c\u003c= props.varname\u003e\u003e`\nFor running javascript code, you can use `\u003c\u003c props.code \u003e\u003e`\n\nThats it. Thats the whole syntax.\n\n## Example\n```ts\nconst template = `\n    \u003ch1\u003e\u003c\u003c= props.title \u003e\u003e\u003c/h1\u003e\n    \u003cp\u003e\u003c\u003c= props.calc \u003e\u003e\u003c/p\u003e\n    \u003cp\u003e\n        \u003c\u003c for(let i = 1; i \u003c= 10; i++) { \u003e\u003e \n            \u003c\u003c= props.i \u003e\u003e Sheep\n        \u003c\u003c } \u003e\u003e\n    \u003c/p\u003e\n`;\n\nconst view = {\n    title: \"Sujal\",\n    calc: \"$100\"\n};\n\nconst html = Solarstache.render(template, view);\n```\nOutput:\n```html\n\u003ch1\u003eSujal\u003c/h1\u003e\n\u003cp\u003e$100\u003c/p\u003e\n\u003cp\u003e\n    1 Sheep\n    2 Sheep\n    3 Sheep\n    4 Sheep\n    5 Sheep\n    6 Sheep\n    7 Sheep\n    8 Sheep\n    9 Sheep\n    10 Sheep\n\u003c/p\u003e\n\n\u003c!-- Note: The output is not formatted that well. It is just for demonstration. --\u003e\n```\n\n## Custom Delimiters\nYou can change the delimiters to anything you want.\n```ts\nSolarstache.variableDelimiter = [\"{{\", \"}}\"];\nSolarstache.javascriptDelimiter = [\"{%\", \"%}\"];\n```\n\n\n## Caching\nSolaris by default caches the templates.\nYou can manually cache the templates by using the `parse` function.\n```ts\nconst template = Solarstache.parse(\"\u003c\u003c= props.title \u003e\u003e\");\n``` \n`parse` returns a function to render with props, also caches the template.\nThis cached template can be used to render multiple times.\n```ts\nSolarstache.parse(\"\u003c\u003c= title \u003e\u003e\"); // Caches the template\n\nconst output1 = Solarstache.render(\"\u003c\u003c= props.title \u003e\u003e\", { title: \"Sujal\" }); // Uses the cached template\nconst output2 = Solarstache.render(\"\u003c\u003c= props.title \u003e\u003e\", { title: \"Choudhari\" }); // Uses the cached template\n// Improves performance\n\n```\n\nAll the caches are cleared when the `clearCache` function is called.\n```ts\nSolarstache.clearCache();\n```\nAlso when different delimiters are used, the cache is cleared.\n\n### Happy Coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujalchoudhari%2Fsolarstache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujalchoudhari%2Fsolarstache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujalchoudhari%2Fsolarstache/lists"}