Live data from Hacker News

CSS Modules

glenmaddern.com

11–20 of 93 posts

Re: CSS Modules

#11
post #6

How does a post get to number 1 here with only 5 up votes?

There's extra weight to comments and how fast the upvotes are. If all votes are instant it'll go higher than votes over a longer period.

This is not great. I know there are controls in place to stop chain voting, but if it only takes 5 votes in 5 minutes to reach number 1 then the system is wide open to abuse.

Re: CSS Modules

#12

I've been using CSS Modules in a couple of projects (combined with PostCSS), am pretty happy so far. I think you could actually go one step further and embed the stylesheet in the React component's module using a tagged template string, I haven't looked into how you'd get webpack to extract this into CSS files, but I'm sure it's possible. Eg: https://gist.github.com/AndrewIngram/e3af5e8b70fd89a9a0d3

That (extraction) can be done (React Style does that) but for it to be consistent with JS semantics you need to evaluate code at build time because such template strings can contain interpolations from JS world.

Re: CSS Modules

#13
Aren't methodologies like SMACSS addressing such problems?

I found interesting how the whole thing is specifically related to someone reading the CSS and not used to SASS.

Re: CSS Modules

#14

I've been using CSS Modules in a couple of projects (combined with PostCSS), am pretty happy so far. I think you could actually go one step further and embed the stylesheet in the React component's module using a tagged template string, I haven't looked into how you'd get webpack to extract this into CSS files, but I'm sure it's possible. Eg: https://gist.github.com/AndrewIngram/e3af5e8b70fd89a9a0d3

That (extraction) can be done (React Style does that) but for it to be consistent with JS semantics you need to evaluate code at build time because such template strings can contain interpolations from JS world.

Ah yes, forget about the interpolation issue. I knew there was a reason I stopped digging into it

Re: CSS Modules

#15
post #13

Aren't methodologies like SMACSS addressing such problems? I found interesting how the whole thing is specifically related to someone reading the CSS and not used to SASS.

Forget the last sentence, was referring to another link.

Re: CSS Modules

#16
post #6

Earlier quoted context omitted.

There's extra weight to comments and how fast the upvotes are. If all votes are instant it'll go higher than votes over a longer period.

This is not great. I know there are controls in place to stop chain voting, but if it only takes 5 votes in 5 minutes to reach number 1 then the system is wide open to abuse.

Most systems are vulnerable if you poke around a bit. In my experience the HN voting ring detector is pretty wily.

Re: CSS Modules

#17
post #16

Earlier quoted context omitted.

This is not great. I know there are controls in place to stop chain voting, but if it only takes 5 votes in 5 minutes to reach number 1 then the system is wide open to abuse.

Most systems are vulnerable if you poke around a bit. In my experience the HN voting ring detector is pretty wily.

That I agree with :)

The problem is that no system can detect signal in five votes. The numbers are just too small to be significant.

Re: CSS Modules

#19

Surely not the future.

Not sure why you're getting downvoted. Problems with CSS at Scale are very real (as mentioned in the slide). But this is a super complicated solution. Its like one of the head-over-heels approaches in JoelOnSoftware blogs. Surely there has to be a simpler way.

Its good that the authors are trying. But just look at the picture on this article captioned "This is how intensely we’ve been thinking about CSS". That's where the whole complexity comes from I guess. Good solutions present themselves and fit naturally.

Re: CSS Modules

#20
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.

Post reply on HN