MicrosoftEdge / MSEdgeExplainers

Home for explainer documents originated by the Microsoft Edge team
Creative Commons Attribution 4.0 International
1.31k stars 216 forks source link

[Declarative Shadow DOM Style Sharing] Unclear how this works icw bundling #896

Closed jpzwarte closed 1 month ago

jpzwarte commented 1 month ago

So i like the proposed ability. However, i'm unclear how the proposal impacts development vs production.

In development you most likely have a folder with:

And you would have import styles from './my-custom-element.css' with { type: 'css' }; in my-custom-element.js. So this is a relative path.

How do you get from this relative path to an absolute path as shown in the specifier attribute in the proposal? Do we need new tooling where the custom element is "compiled" to HTML that uses <template shadowrootmode="open"> and convert the relative paths to absolute paths?

sorvell commented 1 month ago

I think the idea would be that whatever tooling you'd be using to emit my-custom-element.js shadowRoot declaratively would also process and emit the styling in the proposed format.

jpzwarte commented 1 month ago

Would that approach exclude using this proposal with buildless setups? Or a mix between buildless & bundled?

sorvell commented 1 month ago

Don’t think so, it’s just up to you to deal with urls at that point… see https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/890

jpzwarte commented 1 month ago

Closing this and picking up the discussion in #890