
Intent to Implement: CSS Modules V1 - simonsarris
https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/vCrJCQxNnzo/OAYI9cPWAQAJ
======
dfabulich
This proposal isn't what you think. In particular, they're not implementing
"CSS Modules" as defined in [https://github.com/css-modules/css-
modules](https://github.com/css-modules/css-modules) but instead they're doing
a Web Components approach, where `import 'styles.css'` will return an opaque
CSSStyleSheet object that you then "attach" to a Shadow DOM root.

To differentiate between the proposal here and the existing "CSS Modules"
thing, I guess I'll call the existing thing "ICSS Modules," since (as an
implementation detail) they compile to so-called "Interoperable CSS" files.

ICSS modules and CSS Modules V1 sound identical (they're both just called "CSS
Modules") but they behave completely differently.

* ICSS modules mangle class names for scoping; CSS Modules V1 returns a CSSStyleSheet, which has to be attached to a shadow DOM root in order to have any scoping.

* ICSS modules export a mapping of class names to mangled names, allowing a tree-shaking algorithm to drop unimported ICSS rules. CSS Modules V1 returns a big old CSSStyleSheet object, which the user would then attach in bulk.

* ICSS modules work great with server-side JS, allowing developers to return plain HTML + CSS with no client-side JS required for rendering. I can't see how a CSSStyleSheet could be used on the server side at all.

* ICSS modules are popular, and developers have been asking (perhaps naively) for native browser support for "CSS Modules" for years, in the same naive way that they wish for JSX built-in to the browser. This proposal is not at all what they meant.

Then there's the naming conflict. Imagine trying to Google for this: "How do I
port my code from CSS modules to CSS modules?"

If I may be so bold as to speak for the many, many developers who never use
Shadow DOM and never plan to start using it, it seems like this proposal is
just going to make our lives worse.

------
rubyn00bie
Here's a link that actually shows some code and I think explains what this is
about: [https://github.com/w3c/webcomponents/blob/gh-
pages/proposals...](https://github.com/w3c/webcomponents/blob/gh-
pages/proposals/css-modules-v1-explainer.md)

It's nice to see Microsoft pushing this forward as it's pretty neat, but we'll
need to see work in Safari and Firefox before this can be truly useful.

~~~
The_rationalist
Or you can just ask Firefox users to install a browser that actually supports
web standards? The standards that chromium supports and firefox don't is
astonishing.

For safari the problem remains because of IOS which has too much marketshare.
That said, there are a lot of IOS users but how much of them are going to use
a non GAFA website? Most of them should be casuals that don't really use
internet outside of top 20 ALEXA. I would like to see statistics of this.

