Re: [w3c/webcomponents] CSS Modules (#759)

> There's a very simple transform of the importer and CSS file to make this work

I don't think that's right in this case; the build will need to provide a server-side runtime implementation of CSSStyleSheet, which looks non-trivial to me. The build-time bundler will furthermore need a way to transform constructed `CSSStyleSheet` objects into bundled CSS files and scope them without JS or Shadow DOM. (How, exactly?)

It is precisely my concern that you think this should be pretty trivial, but I claim that it's really _really_ not, and that's why we should stop and think about this for another minute.

> BTW, for tree-shaking, CSS Modules already give us a huge leap forward: by enabling finer-grained and explicit dependency CSS, we can use the native tree-shaker - the browser doesn't load modules that aren't imported.

But by dropping `@import`, it'll be a big step backward in practice, as the bundler will have to flatten all `@imports` together and let the browser download all of the imported rules, whether they're needed or not.

> As for the name, I'm not sure what else you would reasonably call this feature

"Stylesheet modules" is short and sweet. I provided two other names as well.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/759#issuecomment-520613149

Received on Monday, 12 August 2019 22:06:54 UTC