Design before you “minify”
In a fit of frustration the other evening, I posted this on Twitter:
If your website needs a JavaScript “minifier” to load quickly, then you wrote too much fucking JavaScript. Same goes for CSS.
— Don Melton (@donmelton) May 20, 2017
I’m not really a curmudgeon, I just play one online. And apparently folks are watching my show because that one-off rant received a lot more “likes” and “retweets” than I was expecting.
But some were confused by what I meant. So I’ll explain.
That vulgar epiphany came to me while I was measuring the embarrassing sloth of this website1 and examining the sluggish behavior of quite a few others. Obviously I shouldn’t cast the first stone, but there’s a lot of unnecessary bloat elsewhere out there, too.
I’m not saying that you shouldn’t use tactics like minification, resource concatenation, server-side compression, etc. to improve performance.
But have a strategy for performance first. Have a design. Consider whether you need all those libraries you’re tempted to include. Consider whether you need to write even more JavaScript, CSS, JSON and Christ-knows-what-all to “improve” the user experience.
Maybe leveraging those Content Delivery Networks will let you get away with it. But maybe they won’t.
Then again, what the hell do I know? I’m just an old Web browser guy. So I’ll leave you with this quote, sometimes attributed to Albert Einstein, that I kept in my .plan
file back when that was a normal thing to have around:
Everything should be made as simple as possible, but no simpler.
I’m just trying to get people to think a little bit more before they deploy. I certainly wish I had here.
-
I’m currently over-burdened with a relational database, a resource-hungry theme, complicated plugins and other dynamic functionality I’ll probably never use. So I’m seriously considering a return to just static HTML. ↩