Live data from Hacker News

Show HN: CSS Extras

github.com

61–66 of 66 posts

Re: Show HN: CSS Extras

#61

It would be quite nice to see some more "killer" uses of this new feature that aren't just "we removed some duplication and... saved less than 1% of our loc". And maybe there are some really compelling ones... I think the only really useful one I see here is `--abs`, which really should just be built-in.

It's not for DRYing/golfing code.

The main use case of functions is that you can parameterize code. This lets you parameterize stylesheets, like set a base font size and primary color, and then derive your whole theme from it, from spacing to secondary border colors to how buttons look when they're hovered.

Re: Show HN: CSS Extras

#62

Whoo. I’ll be the first hyper negative prototypical HN commenter. I’m glad I don’t work on browser engines for a living. CSS is getting more complex and spaghetti-capable by the day. > Currently only supported in Chrome 141+. The @function rule is going through the W3C standardization process and will be available in other browsers soon. Also, pretty tired of Chrome effectively front-running standards as a not-so-sub…

One person's front-running is another's reference implementation. Although, yes, CSS is getting more complex because everything on the web is. What's the last standard feature to really be taken away after actually existing in the wild for a while? XHTML and Flash (effectively a standard if not in reality)?

Using CSS Grid, which we just got in 2017, is so much easier than using floats and tables. These layouts were also very fragile.

Part of the problem is once people get used to doing something a particular way, they don’t want to change.

I looked at a friend’s website the other day and it’s using a table-based layout and it wasn’t even that old!

Nothing can be removed from CSS because sites from the 90’s and the early 2000’s still have to work in today’s browsers.

The good news is most greenfield projects can use floats and tables in the way they were intended, which wasn’t ever layout.

Re: Show HN: CSS Extras

#63
post #55

It is time to reject this ugly double dash prefix kebab-cased variables names. PHP looks better in comparison. What goes in some people's mind when they come up with these ugly conventions and rules?

> What goes in some people's mind when they come up with these ugly conventions and rules?

The earlier versions of the CSS spec had no double dash prefix sigil for custom properties.

You could just make up a value like: "bigger", "accent", etc...

The problem is that CSS needs to be able to add new properties overtime, and we don't want any name collisions with variable names that web developers have already taken.

So we need a sigil that only custom properties and that regular properties can't use.

- We can't use `$` because that would conflict with SCSS, and we wouldn't be able to use custom properties in the same file as scss variables

- We can't use any of the following symbols because they're already used in CSS itself: !@#.,%^&>~:?\|{}`()+*/"';

- We can't use `- We can't prefix with `-`, `_`, or `__` because developers have already used them in their files.

- That seems to leave just: `--` or something even weirder.

So `--` is longer but in the context of not breaking anything, it's the best option on the table.

-------------

Now we're in this unusual spot where custom properties are genuinely more useful then what came before (they're like scss vars but they can update live and cascade too!), but they're a little wordy.

Probably not for long though, the upgraded attr() function will remove a lot of the massive walls of definitions that too many design systems and methodologies are relying on, and the upcoming functions used with the conditionals (if, media, where, not etc...) will take that further.

Re: Show HN: CSS Extras

#64

I’m so confused why people are ragging on this. Why is this considered detrimental? Looks pretty good to me…

People who don’t understand the problems CSS has to solve are opposed to CSS solving those problems. Sure it can all be stuffed into Tailwind classes!!

the problem is that if there was a tailwind-like replacement for css, nobody would ever use css again lmao.

Re: Show HN: CSS Extras

#65
post #64

Earlier quoted context omitted.

People who don’t understand the problems CSS has to solve are opposed to CSS solving those problems. Sure it can all be stuffed into Tailwind classes!!

the problem is that if there was a tailwind-like replacement for css, nobody would ever use css again lmao.

It is, it's called inline styles

Re: Show HN: CSS Extras

#66

It would be quite nice to see some more "killer" uses of this new feature that aren't just "we removed some duplication and... saved less than 1% of our loc". And maybe there are some really compelling ones... I think the only really useful one I see here is `--abs`, which really should just be built-in.

It's not for DRYing/golfing code. The main use case of functions is that you can parameterize code. This lets you parameterize stylesheets, like set a base font size and primary color, and then derive your whole theme from it, from spacing to secondary border colors to how buttons look when they're hovered.

You can do that with custom properties already. AFAICT functions don't introduce any new abilities on that front (apart from the aforementioned DRY-ing).
Post reply on HN