{"id":20882883,"url":"https://github.com/heineiuo/saxt","last_synced_at":"2026-05-19T21:34:03.621Z","repository":{"id":66092607,"uuid":"124210539","full_name":"heineiuo/saxt","owner":"heineiuo","description":"A streaming template engine based on sax-js, primary for server side render.","archived":false,"fork":false,"pushed_at":"2018-03-09T06:58:39.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-28T09:53:44.476Z","etag":null,"topics":["nodejs","stream-api","template-engine"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/heineiuo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-07T09:16:53.000Z","updated_at":"2018-03-22T08:42:38.000Z","dependencies_parsed_at":"2023-03-23T08:48:18.023Z","dependency_job_id":null,"html_url":"https://github.com/heineiuo/saxt","commit_stats":null,"previous_names":["heineiuo/sax-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/heineiuo/saxt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fsaxt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fsaxt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fsaxt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fsaxt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heineiuo","download_url":"https://codeload.github.com/heineiuo/saxt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heineiuo%2Fsaxt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33233740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T15:49:41.270Z","status":"ssl_error","status_checked_at":"2026-05-19T15:49:22.917Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["nodejs","stream-api","template-engine"],"created_at":"2024-11-18T07:33:47.443Z","updated_at":"2026-05-19T21:34:03.606Z","avatar_url":"https://github.com/heineiuo.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# saxt\n\nSAX T(emplate)\n\nA server-side template engine based on sax-js\n\n## Install\n\n```bash\nnpm i saxt\n```\n\n\n## Usage\n\nsaxt has a very simple syntax. \n\nAll `tagName` is html tag. The `attr` can be static value or wrapped with `{}`, then it will bind view props, and one special attr is `children`. If attr is `children`, the attrValue will be passed to the children element.\n\n**Important**: If the bind value is not a string type, it will be stringify by `JSON.stringify` and encoded by `encodeURIComponent`\n\nThe `saxt()` will return a readable stream, like: \n\n```jsx\nconst saxt = require('saxt')\nconst view = { foo: \"bar\" }\nconst stream = saxt(`\u003cdiv children={foo}\u003e\u003c/div\u003e`, view, { /* some options */ })\n\nlet result = ''\nstream.on('data', (data) =\u003e {\n  result += data\n  // or do stuff like `res.write(data)`\n})\n\nstream.on('end', () =\u003e {\n  assert(result === `\u003cdiv\u003ebar\u003c/div\u003e`)\n  // or do stuff like `res.end()`\n})\n```\n\n\n## Example\n\n```jsx\nconst saxt = require('saxt')\nconst view = {\n  post: `\u003cdiv\u003e\n          \u003cp\u003ehello world\u003c/p\u003e\n        \u003c/div\u003e`,\n\n  charset: 'utf8'\n}\n\n// 1. children example\nsaxt(`\n  \u003cdiv id=\"post\" children={post} /\u003e\n`, view)\n\n// result \u003e\u003e\u003e\n\u003cdiv id=\"post\"\u003e\n\u003cdiv\u003e\n  \u003cp\u003ehello world\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\n\n// 2. attr example\nsaxt(`\n  \u003cmeta charset={charset} /\u003e\n`, view)\n\n// result \u003e\u003e\u003e\u003e\n\u003cmeta charset=\"utf8\"\u003e\u003c/meta\u003e\n\n```\n\n## License \n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheineiuo%2Fsaxt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheineiuo%2Fsaxt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheineiuo%2Fsaxt/lists"}