Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

demonstrates server-side rendering a web component

1
2
3
4
5
6
7
8
9
10
11
12
import enhance from "jsr:@enhance/ssr";
export default async function() {
let html = enhance({
elements: {
"my-tag": function({ html }) {
return html`<b><slot></slot></b>`;
},
},
});
return new Response(html`<my-tag>my content</my-tag>`, { headers: { "content-type": "text/html" } });
}
brianleroux-ssr_a_web_component_for_fun.web.val.run
March 22, 2024