Hacker News new | ask | show | jobs
by stephenr 156 days ago
I didn't say I can't read it. I asked who thought it was a good fucking idea. I guess you've answered that implicitly.

Embedding every style directly into the style attribute is also readable, and as a side benefit it doesn't need a build step just to make your styles actually work.

I can now see exactly why OP made this post. If a client told me they don't want to use something akin to bootstrap or any other sane css library, and that instead I will need to ensure that every element has every manner of css states expressed as a faux class, I wouldn't even stop to make a coffee before telling them how far they can jump.

This sounds perfect for front end “developers" who struggle even with css, and want any reason possible to pad out their billable/working hours doing nothing productive.

Oh what's that, you want to change the style of standard button everywhere in the codebase?

No of course we can't just update a single css file you silly goose.

I feel like half the bad problems in web development are because JavaScript developers saw that j2ee guys had ant and whatnot, and said "hey what if we started inventing reasons to have a build step"?

> button class="button"

The thing is, that is more readable for a sane code base. If I can glance and know it's using the correct standard button class, it means I don't need to memorise the fucking pixel sizes and states of button paddings.

I get it alright. It's a solution looking for a problem that doesn't exist, and instead found a crowd of "developers" looking for anything shiny to pad their resume and keep themselves looking busy.

3 comments

> Embedding every style directly into the style attribute is also readable, and as a side benefit it doesn't need a build step just to make your styles actually work.

Critical difference: media queries are unavailable to inline styles, making impossible to implement responsive designs this way. And anyway, CSS is so much more verbose than Tailwind that it really wouldn’t be very readable outside of toy examples.

Personally, I have used CSS since it was first created. I also have used Bootstrap and Foundation, but found them brittle and cumbersome. Now I just write 95% of styles with Tailwind.

> Critical difference

Yeah that's the critical difference, absolutely.

> Now I just write 95% of styles with Tailwind.

Which everyone says is only really useful if you use in a JSX Component...

So you're writing it in XML...

But then that gets converted into JavaScript....

Which then writes out some HTML and CSS?

I will absolutely not be surprised when someone declares that the XML part of JSX is too verbose and creates a library to generate the JSX code. Fuck it who am I kidding, it probably already exists doesn't it?

100% with you on this, know you’re not the only one bewildered by the insanity of ignoring the cascade, styling everything from scratch, and placing it all in a list of classes.
Clearly you’ve made your mind up so I won’t push harder, except one point:

> Oh what's that, you want to change the style of standard button everywhere in the codebase?

Tailwind excels when you are using component based frameworks. This change should be at least as simple as updating main.css, except it’s in Button.tsx

Why am I not surprised this rube Goldberg style machine seems like a rational thing to people who write xml to generate JavaScript to generate html.
I think these debates ultimately come down to what you’re making with these tools: is it documents or application interfaces? If it’s documents, then plain HTML, CSS and a touch of JS sprinkles on top works very well, as they were designed for this. If you’re making software, though, at some point you’re going to need some additional tooling to make it feasible.
> at some point you’re going to need some additional tooling to make it feasible.

I mean sure, most people will pick some kind of abstraction over parsing and constructing raw HTTP messages.

But it boggles the mind that apparently a large chunk of "developers" cannot see the insanity in writing XML to generate JavaScript which generates HTML and CSS because they want to write `<Button variant="primary">Save</Button>` rather than... `<button class="primary">Save</button>`.

Like I said earlier: so much of the folly in the NodeJS community looks like bizarre adoration of early-2000s J2EE stack.

You have a language that requires no AOT.. ah better invent increasingly convoluted and ever-changing build processes for it.

You're writing output that's essentially just a string to be sent over the wire... ah better create a wrapper for the wrapper that creates the service which renders the string.

But sure. That is totally a rational approach to development, and the nodejs community has never shown itself to be prone to chasing shiny useless things or cargo culting. I must just be overreacting.

> But it boggles the mind that apparently a large chunk of "developers" cannot see the insanity in writing XML to generate JavaScript which generates HTML and CSS because they want to write `<Button variant="primary">Save</Button>` rather than... `<button class="primary">Save</button>`.

I'm wondering if some of the disconnect here is that you don't have personal experience with this type of development, so you might not see what pain points it solves.

The first thing I would mention is that components encapsulate function and styling. Buttons don't illustrate this well because they're trivial. But you can imagine a `<DatePicker>` that takes a `variant` property ("range" or "single"), `month` and `year` properties, and perhaps a property called `annotations` which accepts an array of special dates and their categories (`[{date: "2026-07-04", code: "premium_rate"}, {date: "2027-07-07", code: "sold_out"} ...]`). The end result is an interactive picker that shows the desired span, with certain dates unselectable and others marked with special color codes or symbols. You're going to have a very unpleasant time implementing that with globally scoped CSS classes.

And this isn't a string sent over the wire. The "document" that the browser renders is changing continuously as you interact with it. If you were to open Chrome Devtools and look at the subtree of the DOM containing the date picker, you would see elements appearing and disappearing, gaining or losing classes and attributes, in real time as you select/deselect/skip forward/etc. That's what makes it work, rather than being a static drawing of a calendar.

I personally do not like the Javascript frontend ecosystem. It's hacks on top of hacks on top of hacks. But, do you know another way to deploy software that's cross-platform and basically free of gatekeepers? Sometimes we just have to do weird things because they're really useful.

> I personally do not like the Javascript frontend ecosystem. It's hacks on top of hacks on top of hacks. But, do you know another way to deploy software that's cross-platform and basically free of gatekeepers?

One way is what I call the "Modular MVC pattern" that involves pure js routing and manual DOM manipulation without using any framework at all. You handle complexity in two ways: by modularizing the "controller" parts into multiple js modules for each route, and "view" parts into multiple HTML partials - and using the event bus pattern if your app gets too complex (as alternative to modern reactive frameworks like react/vue).

Shameless plug: I've tried to implement this exact pattern with limited success in Abhyasa Quiz App[1], a side project.

[1]: https://abhyasa.pages.dev/

> you don't have personal experience with this type of development, so you might not see what pain points it solves.

That all depends what you mean by "this type of development".

Do you mean development targeting a browser? Do you mean development targeting client-side interaction in a browser? Or do you mean writing JSX/React/Whatever flavour of the week is hip with the NodeJS community?

If you meant either of the first two: I have about 20 years experience.

If you meant the last: No. If I wanted to be a masochist that badly I'd buy my wife a leather whip and a strap on.

As much as I generally avoid front-end dev when I can now, at one point it was a much greater part of my work. I've written modular/resuable client-side libraries/widgets (i.e. self-contained elements that other developers then used in their own separate projects to add functionality... you know, a "component" by another name) since IE6 was not just in-use, but current and popular. So to rebut your claim: I'm well aware of the "pain points" developing code like this for re-use.

> You're going to have a very unpleasant time implementing that with globally scoped CSS classes.

Have you ever used CSS or Bootstrap before? You know that bootstrap is meant to be a starting point for your codebase, right? Even the most bare-bones official Bootstrap "example" designs use custom CSS specific to that use-case. If you're trying to create anything beyond the most basic hello world page with nothing but bootstrap classes on your markup, you're doing it wrong.

If your argument for using Tailwind (and apparently by necessity, JSX components) is to avoid having someone write a handful of CSS rules specific to the widget you're creating, I can't help you mate.

> It's hacks on top of hacks on top of hacks. But, do you know another way to deploy software that's cross-platform and basically free of gatekeepers? Sometimes we just have to do weird things because they're really useful.

My argument isn't against using Javascript for interactivity on webpages/webapps. As I said, I've been doing it for a couple of decades now. I have my issues with JS, but for browser interaction it's mostly fine.

You see the "current ecosystem" the NodeJS/Javascript community has created, complain about it being "hacks upon hacks" and then still defend the batshit crazy stuff when someone calls it out.

I see the batshit crazy stuff and just ignore it. Just because something new exists, doesn't mean you have to use it. The browser environment for JS is slowly improving, gaining native abilities that we once had implement in libraries or from scratch.... and the majority of the JS-focussed community seems to continue to be obsessed with adding more and more and more layers of abstraction.

If you told 20-year-ago me that the browsers would all supported a native way to implement custom elements (i.e. Web Components) that can be initiated using regular markup in the page, it would never once have occurred to me that the JS developers of the day would then find some way to not just use the built-in capabilities and instead have a dependency chain and build system so complex there are fucking memes about it.