{"id":20513669,"url":"https://github.com/webreflection/uhtml-ssr","last_synced_at":"2025-07-12T12:11:22.765Z","repository":{"id":48417095,"uuid":"323595526","full_name":"WebReflection/uhtml-ssr","owner":"WebReflection","description":"uhtml for Service Worker, Web Worker, NodeJS, and other SSR cases","archived":false,"fork":false,"pushed_at":"2022-05-19T21:16:38.000Z","size":120,"stargazers_count":34,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T23:57:45.203Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.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}},"created_at":"2020-12-22T10:36:48.000Z","updated_at":"2024-07-30T13:48:01.000Z","dependencies_parsed_at":"2022-08-12T19:50:19.678Z","dependency_job_id":null,"html_url":"https://github.com/WebReflection/uhtml-ssr","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fuhtml-ssr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fuhtml-ssr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fuhtml-ssr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fuhtml-ssr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/uhtml-ssr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799928,"owners_count":21163403,"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","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":"2024-11-15T21:12:33.849Z","updated_at":"2025-04-13T23:57:53.293Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cem\u003eµ\u003c/em\u003ehtml-ssr\n\n[![build status](https://github.com/WebReflection/uhtml-ssr/actions/workflows/node.js.yml/badge.svg)](https://github.com/WebReflection/uhtml-ssr/actions) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/uhtml-ssr/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/uhtml-ssr?branch=main)\n\n\u003csup\u003e**Social Media Photo by [Nathan Dumlao](https://unsplash.com/@nate_dumlao) on [Unsplash](https://unsplash.com/)**\u003c/sup\u003e\n\n**[µhtml](https://github.com/WebReflection/uhtml#readme)** for Service Worker, Web Worker, NodeJS, and other *SSR* cases, based on [µcontent](https://github.com/WebReflection/ucontent#readme) logic, but without 3rd party tools (no minification, etc.).\n\nThis module can be used as drop-in replacement for *µhtml* components, but rendered *SSR*, or where there is no *DOM*.\n\nThis module also exports `uhtml-ssr/async` helpers to always resolve asynchronous interpolations.\n\n```js\nimport {render, html, svg} from 'uhtml-ssr';\n\n// render accepts a callback instead of a DOM node\n// or a response object with a `res.write(content)` method.\nrender(String, html`\u003ch1\u003eHello µhtml-ssr 👋\u003c/h1\u003e`);\n//  \"\u003ch1\u003eHello µhtml-ssr 👋\u003c/h1\u003e\"\n```\n\nExports have feature parity with *µhtml*, and pretty much everything else works the same, except:\n\n  * inline *DOM* events are not rendered, these are simply removed\n  * `ref=${...}` attributes receives `null` as there's no `node` or `element` to pass around\n\n\n## Isomorphic \u003cem\u003eµ\u003c/em\u003ehtml Components\n\nIf you are using *CommonJS* you *could* use [require-overrides](https://github.com/WebReflection/require-overrides/#readme) module to fake `uhtml` as `uhtml-ssr`.\n\n```js\n// component.js\nconst {html} = require('uhtml');\nmodule.exports = (name) =\u003e {\n  return html`Hello ${name}`;\n};\n\n// index.js\nconst overrides = require('require-overrides');\noverrides.set('uhtml', 'uhtml-ssr');\n\nconst {render} = require('uhtml-ssr');\n\nconst Component = require('./component.js');\n\nconsole.log(render(String, Component('World')));\n// \"Hello World\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fuhtml-ssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fuhtml-ssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fuhtml-ssr/lists"}