#htmlModules

westbrookwestbrook
2024-10-16

So we have Constructible Style Sheets developer.mozilla.org/en-US/do, should we also have Constructible HTML Documents? 🤔

E.G. where a constructed Style Sheet is shared and mutable, should there be a shared an mutable HTML primitive?

Like a lot of HTML needs to be hyper custom, but maybe the shadow DOM of oft-repeated elements like buttons or inputs? Things that rely heavily of <slot>s over templating?

westbrookwestbrook
2024-09-30

@konnorrogers

@keithamus doesn't need to worry, too much... the Edge team is super invested in bringing a version of this to life for use!! 🚀

It's very exciting: github.com/MicrosoftEdge/MSEdg

westbrookwestbrook
2024-09-01

@keithamus @ryantownsend @developers

I'd be down for a Level 1 that was only collapsing this into HTML: codesandbox.io/p/sandbox/n6q2t

We can get into the magic of templates and arguments and whatnot later...

Then a standard issue HTML-first page could be rendered a la:

<template src="/header.html"></template>
<template src="/nav.html"></template>
<template src="/side-nav.html"></template>

<!-- CONTENT -->

<template src="/footer.html"></template>

🤯

westbrookwestbrook
2024-07-11

@SaraSoueidan At the we see and as the sort of APIs that would open the door to "HTML Macros" in this way. @justinfagnani have we captured that as a specific proposal, or is it still a part of the larger conversation?

westbrookwestbrook
2024-05-31

@mayank “HTML modules” as a macro is such a cool idea. I agree 100% that it’s a place we should focus in on things like this. The sees this as a big next step towards clarifying API. Converting your blog to an explainer would be a great next step.

Disclaimer: in a recent meeting with implementors we agreed that Cross Root Aria and Scoped Custom Element Registries are of higher priority. Having solid plans for when they get done will be 🔥

westbrookwestbrook
2024-02-21

Through the conversation, I wondered whether the misunderstanding that a directly correlates to a was eased or expanded with the theoretical advent of an HTML Module. Much of what we were seeing as seemed more directly related to what we see in , which seems like an interesting path to investigate.

With and HTML Modules, it it possible to recreate what we know now as a in just HTML!?! 🤯

westbrookwestbrook
2024-02-21

😅 Running meetings is not for the feint of heart. Running meetings where the gathering is discussing ways for ward for the web... an even more complicated endeavor! We're doing it at the , however!

Today we had a great session on and and more. Learn more about the discussion, here: github.com/w3c/webcomponents-c

westbrookwestbrook
2023-12-02

@calebhailey Call your senators, I mean browser implementors, and tell them you want to see: github.com/w3ctag/design-revie built of the same syntax features as JSON and CSS modules, Import Attributes!

2023-10-01

@westbrook @davatron5000 @stubbornella I suspect this might overlap with existing #HtmlModules work.

Also one more idea similar to 1.:

5. Could we use this format to do the initial render of a component? By which I mean that #Angular compiles components to #JavaScript which looks like:

```
function renderComponent() {
if (initialRender) {
createComponentDom();
} else {
updateExistingDom();
}
}
```

This always bugged me as inefficient, because the first branch is only ever executed once per component instance. If we compiled components to this SFC format, could we just do the first render at compile time, generate the HTML directly and drop that `createComponentDom` function?

I'm not knowledgeable enough to say that definitely makes sense, but I think it's an interesting idea at least.

Not sure if other frameworks could benefit from similar optimizations, I suspect #React would not, but I'm less clear on non-#VDom frameworks.

2023-09-30

@westbrook @davatron5000 @stubbornella This proposal reminds me a lot of my #HtmlFragments investigation a lot while back (albeit with a very different use case in mind).

blog.dwac.dev/posts/html-fragm

I wonder if there is a potential path for this proposal which is less "Vue in the browser" and more "a primitive SFC format which frameworks can compile to". I wonder if this could solve multiple problems:

1. #SSR small fragments of #HTML after page load.
2. Vertical slice of separation of concerns for a component.
3. Import module format (like #HtmlImports or #HtmlModules).
4. Lazy loading a component and its styles without requiring CSS-in-JS.

Kind of a smorgasbord of requirements but I can see value in the right primitive here.

westbrookwestbrook
2023-08-25

Right after we wrap up this

import { styles } from './styles.css' with { type: 'css' };

thing, can we hop on top of the

import './custom-element.html' with { type: 'custom-element', tagName: 'custom-custom-element-name' };

train?

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst