What Are You Doing with All That JavaScript?

| 2.95 kB

I recently came across Dead Simple Sites. It shows a small collection of websites with a minimalistic design. 90%+ of those websites look good but use the wrong technologies. And with technologies, I mean anything that exists on npm.

Those sites are mostly text and images. Hypermedia. Most of them don't need any JavaScript to fulfill their functionality. Yet they somehow use hundreds of kilobytes of it.

Why?

It's an HTML file. Use HTML. Style it with CSS, not JavaScript. Navigate with an anchor tag sending a GET request. You don't need a framework or library for everything. It's a static website. You can do it. And if you do need JS for some interactivity, try to write it yourself. Don't add a dependency.

You're not only building for the user but also for yourself. By needlessly adding dozens of packages, your future self will think poorly of you. Those packages will be archived, or they'll deprecate half of the features your project uses. Is that worth it?

Just because you are comfortable with something doesn't mean you have to use it for everything. Sometimes your favorite tool sucks. And it's your job, as a developer, to know when that is the case.