Minification Is Evil

by tpetrinaon 11/22/2023, 2:35 PMwith 89 comments

by jmull3non 11/22/2023, 3:08 PM

Don’t agree with this take. Sacrificing the performance for all my users so a minuscule percentage of them can poke around a little easier? All the JavaScript is likely transpiled anyway. They can use dev tools to unminify most of it. Deploying with source maps for production might be a better ask?

by PaulHouleon 11/22/2023, 2:53 PM

Not minifying your code is evil from the viewpoint of people who have to wait for your page to load.

by lcnPylGDnU4H9OFon 11/22/2023, 2:57 PM

The three lines of not-haiku made me want to write a haiku.

  Do not minify
  Your front end is insightful
  Let people inspect

by Zealotuxon 11/22/2023, 3:06 PM

I don't understand; I'm not going to increase the size of my assets just to please the very small minority of hackers who want to play around. I'd rather open-source my code.

by donatjon 11/22/2023, 3:08 PM

With GZIP and moreso Brotli the difference in actual data transfer is negligible anyway.

Minification doesn't really achieve much other than obfuscation these days.

by sanitycheckon 11/22/2023, 3:31 PM

Sadly, not minifying source code can often lead to your idiot customer discovering that their web app is not a magic binary blob and complaining that it's "insecure! anyone can see how it works!", which then in turn leads to your idiot PM agreeing to a new "obfuscate all code" feature without bothering to involve anyone technical.

Deliberately obfuscated JS is far more evil, take it from someone who's had to debug 3rd-party obfuscated JS libs.

by gustavuson 11/22/2023, 3:32 PM

Minification always struck me as a cargo culting type way that "badass rockstar programmers would get every last ounce of performance" out of their code.

Because as noted below minification is much less impactful than compression, but going even further, if you really care about performance the solution is as simple as not shoving 20 metric boatloads of JavaScript in your website in the first place.

If you're argument I'd "muh rural customers" then maybe you should actually look at how your website is designed and ask yourself if you need to ship 3 different frameworks to accomplish what you need to do, or maybe start by stripping out the bloated analytics and ad nonsense in your code.

At the end of the day the author is right, the arguments about whether minification is useful is a teachincal argument, but the business will always want it for the purposes of obfuscating their code, and so we need to push back against the idea of it being an industry norm otherwise managers will push to make it so.

by JodieBenitezon 11/22/2023, 3:01 PM

Hey... good to see this. I was never convinced about this for small to medium JS code base while serving through mod_deflate or similar.

by toss1on 11/22/2023, 3:16 PM

Soooo long gone are the days of the really compact website

There used to be a contest for best website that would fit into 5k bytes. [0]

Now, the bloat is so bad that there is a serious suggestion to nevermind the website, just make people download the entire cargo load and use it locally, merely to get acceptable performance.

If this does not tell us that the entire framework thing has gone too far, abstracted everything from actual speedy code, larded everything up with so much 'just in case' baggage code, etc... IDK what will.

[0] https://www.the5k.org/

by explaininjson 11/22/2023, 5:45 PM

Lots of folks outing themselves as never adding comments with remarks like "compression works nearly as well as minification".

In some of my more logically involved code, the bulk of the bytes are in comments - and they barely compress at all.

Just minify. Nobody cares about your source code; if they do and you want them to, publishing on GitHub is far better as it allows for viewing the TS/ESNext version and separate files too (don't tell me you aren't bundling!!); and working with minified code is not hard, especially now that dev tools have built-in maxifiers.

by tpetrinaon 11/22/2023, 2:35 PM

In the modern era of minifying JS to squeeze out bytes, in certain cases, for smaller, non-commercial sites, it might be better for devs to learn from reading each other's source code.

by qweryon 11/22/2023, 3:34 PM

This is cute. It's refreshing to see such a simple idea published on the internet in such a way. I also got a kick out of the URL.

Thanks for submitting it!

by nsonhaon 11/23/2023, 5:03 AM

Why is everything on the web has to serve some random tinkerer who do not benefit the creator of the website in any way? How about we apply this thinking to other kind of products? An app has to be designed for tinkerers to? A cars, a rockets?..., so everything has to be open source? Why?

by staredon 11/22/2023, 3:24 PM

I have my personal website on GitHub. It gives much more than "not minified code". And actually, I had one interesting email on a widget I created (weighted sorting of blog posts, so it is up to the user to weigh novelty, popularity, my opinion, etc).

by Havocon 11/22/2023, 4:06 PM

Surely better tools to analyse stuff is a better answer.

Think ASM disassemblers - arguably a harder task and people do fine with it

by Veuxdoon 11/22/2023, 3:33 PM

Think of the lives lost to javascript minification.

by eloyon 11/22/2023, 3:17 PM

I think minification should be done on another layer: HTTP compression and HTTP parallelization and that kind of stuff. And just don't make a complex web app, so it will be fast.

by incrudibleon 11/22/2023, 3:16 PM

No.

by djaouenon 11/22/2023, 2:43 PM

Didn’t read the article, but I agree with the title lol

by colesantiagoon 11/22/2023, 3:05 PM

Hard disagree.

Nobody cares about the source, let website authors do what they want.