Live data from Hacker News

CSS Modules

glenmaddern.com

91–93 of 93 posts

Re: CSS Modules

#91
post #90
post #89

Earlier quoted context omitted.

That so much CSS is "bad CSS" indicates that the problem isn't the craftsman so much as the tool...

Ah, I see, so when I attempt to use a hammer as a wrench I can claim the hammer is a horrible tool. CSS does exactly what it was designed to do and does it quite well. It only goes "bad" when people attempt to make it do things it wasn't designed to do. Blaming the tool for that is the sign of a bad craftsman.

Exactly: CSS wasn't designed for the problems we're trying to solve. We're trying to invent the proverbial wrench.

Re: CSS Modules

#92
post #22

Shadow DOM completely solves this problem in a better way by scoping styles to a shadow root. The scoping allows the browser to be smarter about style recalc as well. I do really like the idea of importing CSS into JS as a module to access the classnames and IDs though. I would like to do a similar thing with HTML imports as modules: import references to elements based on id.

Unfortunately Shadow DOM inherits CSS properties such as color;font-family.

Yes, certain properties cascade through the shadow boundary. That's completely intended, and easy to work around by using a shadow-scoped reset if you need to, but otherwise it's useful to be able to set the font or color for an entire tree-scope at once.

Re: CSS Modules

#93
post #91
post #90

Earlier quoted context omitted.

Ah, I see, so when I attempt to use a hammer as a wrench I can claim the hammer is a horrible tool. CSS does exactly what it was designed to do and does it quite well. It only goes "bad" when people attempt to make it do things it wasn't designed to do. Blaming the tool for that is the sign of a bad craftsman.

Exactly: CSS wasn't designed for the problems we're trying to solve. We're trying to invent the proverbial wrench.

Then stop blaming the tool for bad craftsmanship. Maybe if we lay the blame where it belongs then something constructive might appear.
Post reply on HN