{"id":20080650,"url":"https://github.com/bluzky/nano-template","last_synced_at":"2026-03-06T03:30:49.106Z","repository":{"id":77211925,"uuid":"63542331","full_name":"bluzky/nano-template","owner":"bluzky","description":"A lightweight and pure javascript template engine","archived":false,"fork":false,"pushed_at":"2017-03-14T15:00:20.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T13:26:23.636Z","etag":null,"topics":["lightweight","pure-javascript","template-engine"],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/bluzky.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":"2016-07-17T16:45:53.000Z","updated_at":"2019-03-14T09:45:46.000Z","dependencies_parsed_at":"2023-03-12T00:14:58.102Z","dependency_job_id":null,"html_url":"https://github.com/bluzky/nano-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bluzky/nano-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzky%2Fnano-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzky%2Fnano-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzky%2Fnano-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzky%2Fnano-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluzky","download_url":"https://codeload.github.com/bluzky/nano-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluzky%2Fnano-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30160828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"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":["lightweight","pure-javascript","template-engine"],"created_at":"2024-11-13T15:29:26.119Z","updated_at":"2026-03-06T03:30:49.085Z","avatar_url":"https://github.com/bluzky.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nano-template\nA lightweight and pure javascript template engine\n\n# Usage\n\n### 1. Basic usage\n\n**Javascript**\n```js\nvar templateString = \"Hello {{name}}\";\nvar template = nano.compile(templateString);\n\nconsole.log(template.render({name: \"Nano\"}))\n```\n\n**Output**\n```html\nHello Nano!\n```\n\n### 2. Render template with context\n**Template**\n```html\n\u003cscript type=\"text/template\" id=\"list-template\"\u003e\n  \u003cul\u003e\n    {% ctx.$.each(data, function(item)do %}\n      \u003cli\u003e{{item}}\u003c/li\u003e\n    {% end) %}\n  \u003cul\u003e\n\u003c/script\u003e\n```\n\n**Javascript**\n```js\nvar context = {$: jQuery};\nvar data = ['this', 'is', 'an', 'array'];\nvar templateStr = document.getElementById(\"list-template\").innerHTML;\nvar template = nano.compile(templateStr);\nconsole.log(template.render({data: data}, context));\n```\n\n\n# Syntax\n\n### 1. expression:\n\n  **Template**\n\n  `\u003cspan\u003e{{ \"hello\" + \" world\" }}\u003c/span\u003e`\n\n  **Output**\n\n  `\u003cspan\u003ehello world\u003c/span\u003e`\n\n### 2. for loop block\n\n  **Template**\n  ```html\n  {% var items = ['apple', 'pen', 'pineapple'] %}\n  \u003cul\u003e\n    {% for(var i = 0; i \u003c items.length; i++)do %}\n    \u003cli\u003e{{ items[i] }}\u003c/li\u003e\n    {% end %}\n  \u003c/ul\u003e\n  ```\n\n  **Output**\n  ```html\n  \u003cul\u003e\n    \u003cli\u003eapple\u003c/li\u003e\n    \u003cli\u003epen\u003c/li\u003e\n    \u003cli\u003epineapple\u003c/li\u003e\n  \u003c/ul\u003e\n  ```\n\n### 3. if .. else block\n\n  **Template**\n  ```html\n  {% if(10 % 2 == 0) do %}\n  \u003cb\u003eODD\u003c/b\u003e\n  {% else %}\n  \u003cb\u003eEVEN\u003c/b\u003e\n  {% end %}\n  ```\n\n  **Output**\n  ```html\n  \u003cb\u003eEVEN\u003c/b\u003e\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluzky%2Fnano-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluzky%2Fnano-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluzky%2Fnano-template/lists"}