HNHacker News
TopNewBestAskShowJobs

jacamat

39 karma · joined January 30, 2016

submissionscomments
jacamat··on Police push legal boundaries to get into cellphones
jail is not that bad.
jacamat··on Google personalizes search results even when you’re logged out, new study finds
Localization != personalization.
jacamat··on Tailwind: style your site without writing any CSS
I'll definitely respond to this more later. ;)
jacamat··on Tailwind: style your site without writing any CSS
It’s not reusable. It’s not consistent. It’s not scoped.

It may be hard to see now how it will bite you now, but I promise you, it will. It would take hours to explain why, but I am speaking from years of experience here.

There is a reason large organizations have abandoned this approach, and it isn’t just personal preference.

This talk gives a pretty good explanation, Airbnb.design, Netflix, Facebook, and Instagram have many others

https://youtu.be/TuLY1cYM57g?t=530

jacamat··on Tailwind: style your site without writing any CSS
Mixins FTW!!
jacamat··on Tailwind: style your site without writing any CSS
But I only want the element to be the color it IS, not a range of colors it could be. Whats to stop a dev using $concrete when they should be using $cloud? or $linkGray instead of $headerLinkGray?

these inconsistencies compound, especially across teams.

jacamat··on Tailwind: style your site without writing any CSS
There’s no magic. Remember that at the end of the day, no matter what approach you take to your CSS, we are all dealing in trade offs.

I like to say, that with components, you encounter “a new level of bugs.”

With Functional CSS, you deal mostly with incidental bugs. “This container has margin 10 and this one has 15!” or “This text-red is overriding all my text!” Individually, these are annoying, but together they can compound into unfuckable problems. Right now I’m working on rebuilding a header that was styled with this approach, and ultimatley wound up unable to remove certain classes without breaking other elements. Something as simple as moving the text from one side of the screen to the other involves building an understanding of how they work individually, which is very challenging in a site as large as ours.

Enter my new header, a component. Its got a parent of .HeaderComponent and everything is scoped inside of it. If I delete, say, a .Link here, it doesnt affect links elsewhere on the site. And since I include re-usable mixins for base styles, like text, its easy to (say) @include BodyFont; or HeaderFont; without affecting the page or the site as a whole.

What I mean when I say “a new level of bugs” is that how and why you build things becomes more important. If I build a header component, but a large change happens elsewhere on the site, its unlikely I will change my original component. I’ll make something new and call that, instead.

In this process you can wind up with poorly built components, things that wind up not being used as much as you thought, etc. But the beauty of it is that getting rid of them is SIMPLE. I made a lot of mistakes when I started building doggos.com with components, but I’m really excited about how easy they were to remove. If you just make something new when you need something new, you wont have a bunch of legacy code following you around everywhere.

That probably isn’t a greaaat explanation, but I’m very happy to expand further or give you some links. In particular, Airbnb.design has some great lessons on why they ultimately went this direction, and they do a much better job of explaining it than I!

jacamat··on Tailwind: style your site without writing any CSS
Avoiding the cascade is kind of the point, although I'm sure that sounds antithetical. IMO, the cascade should be treated with an "opt-in" approach, where you have a fine degree of control over what, precisely, is cascading and why.

In general, with component CSS, you will tend to avoid the cascade, except within your component. This is actually where utility classes have some value - if they're scoped very tightly to the parent, and their effects are well-understood - then your single purpose class can add an easy way to do simple updates.

That being said, for my part, and on my own website (doggos.com) we do not use any form of utility classes whatsoever. The entire website depends upon isolation, and through this isolation, I have a degree of control that I've not found in applications that have opted for other methods.

In short, it's worked very well for us.

As for your dark mode example... you should take a look at how Apple made dark mode a reality with their new Mojave update. I think you will be surprised at the level of isolation their interface demands and, although we're no longer talking about the web here, just how easy it was for them to implement...relatively speaking.

In short, I can make a site go dark with components, no problem.

jacamat··on Tailwind: style your site without writing any CSS
Sure thing. Due to an NDA, I can’t get into granular detail about the site, but I’m more than happy to expand on the problem.

When I started here, I sort of “inherited” a large stylesheet written in the classic BEM/Tachyon style of CSS. I can see why the author chose this method, because at the time the website was small and functional classes seem like a really good thing, as they help you get up and running quickly.

Over the years, however, the site got more popular, and now the demands of the interface are increasing. At one point, it was perfectly OK to do, say, “container mt-5 mb-5 p-20 text-green” etc. This flexibility allowed the site to grow, and while the CSS did bloat, the impact was seen as negligible for years.

Now the site sees 50-80k+ DAU, and seeing as the business is very established, it makes sense that we would want to add bells and whistles to the UI that wasn’t on the roadmap those years ago, like theming, widgets, or simply making a previously non-responsive page responsive.

In Tachyons, and in Tailwind, the abundance of utility classes means that even the best, most organized authors will create inconsistencies. The original container styles from earlier might look something like “container mt-5 mb-5 p-20” in one place and “container mb-30 mt-30” or “container bg-dark pt-5” in others.

It may seem trivial to just add and remove classes at will, but it isn’t. Removing a margin-bottom from one element inevitably affects the position of another on the same page, and trying to reconcile these inconsistencies _usually_ means an override, because figuring out how to rearrange functional classes without breaking anything else is a time suck.

Removing this style of CSS from the project has been tedious, but necessary. Now that we build with small, immutable, scoped components, its trivial to drop in a new component (or remove it) from anywhere without affecting anything else. And you avoid the unexpected inconsistencies created using utility classes by, well, avoiding them. As someone that used to love BEM, tachyons, Atomic CSS, etc., the lack of scope, unpredictability and huuuuge bloat created by overrides steers me away from it even for the tiniest of projects.

jacamat··on Tailwind: style your site without writing any CSS
No, the key phrase is, "We don't think this is the best way to write CSS."
jacamat··on Tailwind: style your site without writing any CSS
in what way is that consistent tho?
jacamat··on Tailwind: style your site without writing any CSS
you have that with tailwind too, lol. probably even worse the bigger your app is.
jacamat··on Tailwind: style your site without writing any CSS
The benefits absolutely do not outweigh the cons. For starters, your CSS can never compile down to a smaller size than component CSS - ever. Because of the nature of compositional classes the plateau of problems expands out almost infinitely, and the resultant inconsistencies necessitate new overrides, more code, more complexity, more misdirection.

What size site do you work on? How often do you have to completely change an interface, or move a component from one place to another without it breaking at all, and how well does that work for you with Tailwind? How do you plan to scale this codebase consistently across organizations, teams, potentially platforms?

Tailwind and the frameworks like it are absolutely terrible at scale. I've spent years of my life trying to remove functional css from sites trying to scale while it holds them back.

jacamat··on Tailwind: style your site without writing any CSS
Everytime I see Tailwind/Tachyons/Functional CSS at the top of HN I die a little inside. I've said it before and I'll say it again: if you actually like this kind of CSS, you probably don't work on large websites. And when you do, the reason people hate it so much will become abundantly clear to you.

Functional CSS makes for an unscaleable, inconsistent, unmaintainable dumpster fire of styles that is objectively worse than just writing regular CSS.

<sarcasm> But it's convenient, right? So who cares! AirBnB, Facebook, Walmart, Github, and Twitter are all probably wrong anyway. </sarcasm>

jacamat··on In defense of functional CSS
This is all really terrible advice and my only conclusion is that you have never actually had to maintain websites that use this approach toward CSS as they grow past being a little one off blog into a large, customer facing, PWA.

With this method of CSS it will take years to consolidate, update and redesign your application. Ask me how I know. :-)

jacamat··on In defense of functional CSS
Yes and (moslty) no. Cascading that reaches “outside” of its component to affect other things is bad. So it is all about your approach to the cascade. Most people who have been working on the front end still struggle to grasp the concept of encapsulation & isolation when it comes to their CSS.

In my experience working on a web app that sees +80k DAU, the most difficult updates to our UI are ALWAYS in the cases where somebody wasnt cogniscent of the cascade. Or was, and used it when they shouldn’t have.

IMO, theres a lot of pushback to this technique and not a lot of questions into its benefits, but plenty of questions as to why its “just like this” so “why should I use it.”

I encourage you to consider the benefits of an isolated approach to UI, or perhaps try building something with it and see how the method compares to your current approach.

Or, we can all go on assuming that Airbnb, Facebook, IG, et al, have all opted into this approach for no reason

jacamat··on In defense of functional CSS
You’re 100% correct on the cascade being bad and causing incidental breakage. The people downvoting have clearly not run into these problems yet or it would be obvious to them that your reply is in no way wrong, lol
jacamat··on In defense of functional CSS
I don’t get why people are still defending this method of CSS. When - or, perhaps I should say 'if' - your webapp has to scale you will realize the enormous amount of problems you’ve created for yourself using this method of CSS.
jacamat··on Ask HN: Where can I find high-end stock images for a website?
Unsplash. Just use Unsplash. :D
jacamat··on AMD, which lost over $2.8B in 5 years, takes a hit after new report
literally how the press works..
jacamat··on W3C abandons consensus, standardizes DRM, EFF resigns
How is it not in their interests?
jacamat··on ESPN Football Analyst Walks Away, Disturbed by Brain Trauma on Field
The comparison to a Gladiator sport is a good one.

I see no reason why ESPN/NFL/et al., can't provide comprehensive health insurance to every current & former player for life - as reducing the violence of the sport doesn't really seem to be on the table, broadly speaking.

jacamat··on Low-fat diet could kill you, major study shows
Even if you are fat there’s nothing wrong with butter and cheese. Especially if you are fat, IMO.
jacamat··on Low-fat diet could kill you, major study shows
Don't know why people think fat is bad in the first place. But then again I have been keto for ~2 years. ¯\_(ツ)_/¯
jacamat··on Out of all major energy sources, nuclear is the safest
I believe wind and solar are the best solutions for our future. But many concerns mentioned in this thread are becoming irrelevant in the face of emerging nuclear storage technology.

For example, the pebble bed reactor system eliminates the risk of a meltdown by no longer storing spent fuel in rods; it also makes the process for extracting fuel significantly more efficient. Presently we can only extract about 4% of energy contained in nuclear materials, with a PBR system the "pebbles" stay in circulation for longer, meaning we can extract more energy and pursue new designs that could ingratiate these systems into our cities without the catastrophic risks we face today.

The more people focus on this technology, the better it will get. But we can't improve if we don't try.

https://en.wikipedia.org/wiki/Pebble-bed_reactor

jacamat··on What could happen if you refuse to unlock your phone at the US border?
Reset to factory then unlock...
jacamat··on Pugs are anatomical disasters. Vets must speak out–even if it’s bad for business
How do you mean? When you say "misrepresentation."

All breeders (in theory) are breeding to the "breed standard," which means if the standard says to breed unhealthy dogs then that's what they do. Because of the existence of the standard in its current state, even 'pet owners' (rather than dog showers/breeders) will be forced to buy dogs that are unhealthy. It is by design. This is precisely why it must be changed.

I am of course referring to the English Bulldog when I say "all" (this variety is overwhelmingly unhealthy) whereas the American variety seems to be significantly better off.

So - YES, we should change the standard to focus on health. But - NO, breeders are not "the minority." Not all breeders show their dogs, not all handlers breed the dogs they show, but because they are the ones doing the breeding, the responsibility begins with them.

jacamat··on Pugs are anatomical disasters. Vets must speak out–even if it’s bad for business
I looooooove Dalmatian's. They're so pretty and spotty and different looking.

On the other hand, I can't for the life of me figure out why someone in their right mind would buy a bulldog. lol. They slobber and fart and cost a small fortune just to keep alive for a reasonable period of time. Not to mention they literally cannot give birth without a C-section which, to me, is just unfathomable to put an animal through just because you like the way the animal looks. But to each their own, eh?

> "Stipulating that you can only get that package of attributes in a health-compromised breed, I don't think you have a very strong argument"

Not sure what you mean by this. Can you elaborate?

If you want an apartment-sized dog that has like, no health issues, adopt a pit bull. Adopt a mutt. Adopt a labrador. If the dog tears up your shit, hire a trainer. If it needs exercise, exercise it more. Etc.

You can certainly choose a breed (or mix) that will have a significantly better quality of life without sacrificing anything personally. In which case, why would you instead choose a breed that is for-sure without-a-doubt no-way-around-it riddled with problems? The ethical negative seems obvious because there are plenty of other dogs that fit the bill without sacrificing their health from jump.

I will agree with you on education being an important factor in choosing a dog. But very few people have the in-depth education required to make that choice in the first place so, like I said, the responsibility ultimately falls on the BREEDER.

jacamat··on Pugs are anatomical disasters. Vets must speak out–even if it’s bad for business
I think it is unethical to breed brachycephalic dogs. It's merely inconvenient to own them. I don't blame dog owners for not knowing better.

I blame dog breeders for knowing better and breeding the dogs anyway.

Never say "ethically obligated" and "euthanasia" in the same sentence. That is asking the wrong question - but for the record the answer is no. Obviously. In addition to such a thing being impossible, there are easier ways forward. :-)

On suffering, the fact of the matter is that the dogs really have no idea that they're suffering. They just exist. They know nothing more than what they are exposed to, and what they perceive.

I feel that if we are obligated to do anything, it is simply to change how and for what purpose we breed animals. Deciding that the pug can still exist - with a longer nose - or that the Dalmatian can exist after they breed out their uric acid problem is attainable. It just takes work. And support, from pet owners and breed lovers, to guide people and to vote with their money.

jacamat··on Pugs are anatomical disasters. Vets must speak out–even if it’s bad for business
For a long time, as a German Shepherd owner and enthusiast, I believed the old adage about white German Shepherd's being "awful." Granted, in some cases this holds true - pink skin, pink noses - typical of melanin deficiencies in the skin (and often in the eyes & brain) buuuuuut that's not where the bias started.

Some of the founding Shepherd's were white! The foundation stud, Grief, was white. The creator of the breed is on record saying that white dogs have no less working capacity than any other color... So what happened?

Turns out, this was due largely to nazi influence, too. The WWII era really transformed the German Shepherd. From a pastoral sheep-herding companion came a military machine. White dogs, while good at blending in with the flock and being spotted by a Shepherd in the field, were not so good on the battlefield, unfortunately for the same reasons. You can see them coming at night, they are easy targets on a black mountainside.

In other words, the ideas of the time have an ENORMOUS impact on the dogs we create. I don't doubt the Giant Schnauzer story for a second. Breeds evolve to suit the government, the people, and the culture that they are born into...

Page 1 of 2Next →