Imagine being in a situation where you have limited internet access: your internet is slow, or you're relying on a small data bundle, or you are stuck in the middle of nowhere with spotty coverage.
Now imagine that suddenly, you need help. Emergency medical information, food resource locations, shelter, assistance, anything.
Then, in your emergency state, you look up resources on the internet and find... a website that first requires you to load 500 MB of JavaScript, and lord knows what else.
Maybe she's born with it, maybe it's ReactJS. š š»
(Post-publication addendum: 500 MB is an exaggeration even for React. But you catch my drift.)
Essential resources should be as accessible as possible
Information critical to people's well-being should be available to as many people as possible.
Web over apps
The web isāin my opinionāa better place for sharing information than apps:
- Browsers exist on many devices, including handheld gaming devices, giving a wider platform to users.
- Websites do not need to update regularly to even work on devices or be allowed into an app store.
- The web is less commercial and less censored than app stores.
- The maintenance process of web can be much cheaper than apps (depending on the stage of Node.js hell you're in.)
- Browsers will render HTML even when it doesn't recognize it, to the best of their ability.
- The core of HTML and CSS is backwards compatible; old websites still render. (Even if not identical on every device.)
- You (theoretically) have more options for customizing the look and feel of websites, and even browser-specific reader modes.
- [Opinion] Selecting, copying, downloading, and printing of web content is often easier than app content.
How often do we come across older software, plug it in, and it "just works"? Websites, they've got it.
(Good old HTML and CSS: underappreciated, as always.)
Performance and quality matter
Sites should load on crappy internet connections and on older devices, and respect browser and system-wide accessibility settings, and several device input methods (mouse, keyboard, voice, among others).
I do not see as much talk about website performance and size as I would. Usually, the people talking about it are the artisans who care, or those who have been told by tools like Lighthouse that their stats are wrong.
And with that in mind, it does not surprise me that many sites are built on large JavaScript frameworks, more often than is needed.
Bonus point: The current AI boom has led some companies to hoard essential hardware that makes computers go vroom. Do not assume that your next device will be as fast, cheap, or powerful as the one you have now.
Simple marketing sites should not be bloated
I get the allure of JavaScript frameworks: they do all kinds of magical things like routing, hot-reloading, and dynamic interactions without the need to build that boilerplate yourself.
However, can you really justify a large, complicated, and expensive-to-maintain framework for a site that mostly just... shows content?
As I explained in my previous article, Create that blog, a simple site only needs HTML and a bit of CSS, and optionally JavaScript, to work.
You can build a basic site that works, then spice it up with newer features in a process we call "progressive enhancement".
Of course, marketing sites often need a bit more backend logic, usually centered around contact forms. However, building logic around one or two forms can be perfectly done by hand.
Why sacrifice the speed and availability of your site when you don't need it?
You said that light-weight sites might save lives?
I did not exaggerate when I made the title of this article.
All over the world, there are people with limited internet access or very little budget for data bundles.
Some of these people risk their personal safety just to get those few bits of data by bypassing government-mandated censorship.
The internet can help those in need find the resources they need. They do not always have the luxury of downloading large sites or even waiting for them to render.
They need information that is short, snappy, important bits on top, and loads extremely fast.
Extra: Print stylesheets, even in this day and age
While thinking about this topic, I also remembered another phenomenon: print stylesheets.
I wonder how many young web developers still think about print stylesheets. After all, millennials and younger are pretty much a paperless generation.
(Albeit printers kinda asked for it, because they're evil.)
But when information is essential, and internet access or phone battery charge is limited, you might have to take it offline.
You can always print websites, but their default print versions will be full of stuff you don't need on paper. Maybe the print is even unreadable.
Your print stylesheet should remove unnecessary page elements, fully show link URLs, use a white background with black text, and reduce the content to as few pages as possible.
So yes, even in the digital age, create print stylesheets.
Wrap-up
JavaScript frameworks have their place, but I seldom find them justifiable for marketing websites.
For utility sites that present potentially life-saving information, I do not think you can get away with excessive bloat.
(And I didn't even get started about unoptimized media loading on every page. Ah, well, another time, another blog post.)
I find the choice of offloading logic to the client browser even less justifiable these days, given the plethora of available options for server-side rendering and even static site generation.
Moral of the story: Don't use a sledgehammer to drive in a tiny nail.
See also: Original conversation on Hachyderm.io.