I'm looking for a way to use HTML templates. There is no real way. HTML doesn't yet have this feature.

The closest might be server side rendering web components because they're part of the platform and resemble templates in a sense. JSX can be used similarly but is not part of the platform. HTMX with it's focus of locality, therefore markup and extending the platform has a similar goal. MDX is almost exactly right, except serving markdown files isn't the way to go.

Today I learned about HTMLx by purely thinking: "is there MDX but for HTML?" and that looks great and was proposed by Rich Harris of svelte fame but that was 7 years ago and I guess never caught on.

Chris Coyier from Codepen has opinions on this as well and clearly it's something a lot of web developers think about.

I guess I'm going to try using lit-ssr since syntactically that looks right and feels like writing HTML. We'll see how it goes and maybe there will be part 2 to this post later.

See comments for updates or updates