{"id":31055479,"url":"https://github.com/webpro/isum","last_synced_at":"2025-09-15T04:49:17.394Z","repository":{"id":302225347,"uuid":"1009269220","full_name":"webpro/isum","owner":"webpro","description":"isomorphic uhtml","archived":false,"fork":false,"pushed_at":"2025-08-05T15:11:14.000Z","size":12,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T00:33:41.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/webpro.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,"zenodo":null}},"created_at":"2025-06-26T21:19:22.000Z","updated_at":"2025-08-05T15:11:18.000Z","dependencies_parsed_at":"2025-07-01T08:36:18.623Z","dependency_job_id":null,"html_url":"https://github.com/webpro/isum","commit_stats":null,"previous_names":["webpro/isum"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/webpro/isum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fisum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fisum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fisum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fisum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpro","download_url":"https://codeload.github.com/webpro/isum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpro%2Fisum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274748058,"owners_count":25341941,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"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-09-15T04:49:14.417Z","updated_at":"2025-09-15T04:49:17.367Z","avatar_url":"https://github.com/webpro.png","language":"JavaScript","readme":"# isum\n\nisomorphic [µhtml][1]\n\nTiny wrapper that imports `uhtml` in the browser and `uhtml/ssr` in Node.js/Bun\nfor quick \u0026 easy client and server-side rendering (SSR/SSG). With a few extra\nniceties.\n\nAll credits to [Andrea Giammarchi][2] for creating this mighty lib.\n\nExample project using isum: [ANSI.tools][3]\n\n## The Main Idea™\n\n- Plain and web standards-based JS library, i.e. not a (meta) framework\n- Use `render` and `html` to render template literals\n- Optional: use fine-grained reactivity with `isum/preactive`\n\nUse the provided `document` of `isum` and Vite (or something else that\nbuilds/bundles) and get SSG for free.\n\nImport the same from `isum/preactive` for fine-grained reactivity:\n\n```ts\nimport { document, render, signal } from 'isum/preactive';\n\nconst count = signal(0);\n\nfunction App {\n  return () =\u003e html`\u003cbutton onclick=${() =\u003e count.value++}\u003eClicks: ${count.value}\u003c/button\u003e`;\n}\n\nfunction renderApp() {\n  render(document.getElementById(\"app\"), App());\n}\n```\n\nThis runs in both browsers and runtimes like Node.js.\n\nPlease refer to [the µhtml docs][4] for details.\n\n## Setup\n\nBootstrap in `index.js`:\n\n```ts\nimport { renderApp } from './app.js';\n\nrenderApp();\n```\n\nInitial template/container `index.html`:\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"styles.css\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cmain id=\"app\"\u003e\u003c/main\u003e\n    \u003cscript type=\"module\" src=\"index.js\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## SSG\n\nRead template, render application, write result:\n\n```ts\nimport { readFileSync, writeFileSync } from 'node:fs';\nimport initSSR from 'isum'; // must import same as in rest of app (e.g. 'isum/preactive')\nimport { renderApp } from './app.js';\n\nconst pages = {\n  'index.html': () =\u003e renderApp()\n};\n\nfor (const [filePath, render] of Object.entries(pages)) {\n  const template = readFileSync(filePath, 'utf-8');\n  const { document } = initSSR(template);\n  render();\n  writeFileSync(filePath, document.toString());\n}\n```\n\nThis renders the `\u003cbutton\u003e` inside `\u003cmain\u003e` into `index.html`.\n\n## Look ma, no bundler!\n\nRun the app in the browser without a build step:\n\n```html\n\u003c!doctype html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"styles.css\" /\u003e\n    \u003cscript type=\"importmap\"\u003e\n      {\n        \"imports\": {\n          \"isum\": \"https://unpkg.com/isum@1.1.0\",\n          \"uhtml\": \"https://unpkg.com/uhtml@4.7.1/keyed.js\"\n        }\n      }\n    \u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cmain id=\"app\"\u003e\u003c/main\u003e\n    \u003cscript type=\"module\" src=\"index.js\"\u003e\u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## CSS imports?\n\nIgnore CSS imports in JS modules during SSG:\n\n```sh\nnode --import isum/no-css build.js\n```\n\nUseful when using e.g. Vite. isum pairs great with Vite.\n\n## Examples\n\n- Bare: [./examples/bare/][5] → [CodeSandbox][6]\n- SSG: [./examples/ssg/][7] → [CodeSandbox][8]\n- Vite: [./examples/vite/][9] → [CodeSandbox][10]\n\n[1]: https://github.com/WebReflection/uhtml\n[2]: https://github.com/WebReflection\n[3]: https://github.com/webpro/ANSI.tools\n[4]: https://webreflection.github.io/uhtml/\n[5]: ./examples/bare\n[6]: https://codesandbox.io/p/sandbox/github/webpro/isum/tree/main/examples/bare\n[7]: ./examples/ssg\n[8]: https://codesandbox.io/p/sandbox/github/webpro/isum/tree/main/examples/ssg\n[9]: ./examples/vite\n[10]:\n  https://codesandbox.io/p/sandbox/github/webpro/isum/tree/main/examples/vite\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fisum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpro%2Fisum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpro%2Fisum/lists"}