Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 1 min read

Our whole app is one HTML file, and we're fine with that

ARLTS is a free English-learning app: vocabulary, grammar, dictation, pronunciation, tests, and word games. The whole front end is one HTML file. The readable copy is about 5.7 MB. People raise an eyebrow at that, but i

ARLTS is a free English-learning app: vocabulary, grammar, dictation, pronunciation, tests, and word games. The whole front end is one HTML file. The readable copy is about 5.7 MB.

People raise an eyebrow at that, but it has worked well for a team of one.

Why one file

  • Nothing to wire up. No build tool to learn, no framework to update. Open the file, change it, reload.
  • Everything is close at hand. A button, its look, and what it does are in one place. Find in file finds all of it.
  • Painless to back up. One file in git, plus a copy with every deploy.

What we do to keep it quick

A 5.7 MB page would be a bad idea to hand to a phone as is. Before each upload:

  1. A minifier (esbuild) cuts the code and CSS down. The readable file never goes live; it's put back after the upload.
  2. Every block of code or CSS over 4 KB moves to its own file named by its hash, which a visitor's phone or computer keeps for a year. A repeat visit downloads almost nothing.
  3. The large word lists aren't in the page at all. The app loads them when a learner opens an activity.

What's hard

  • Merge conflicts would be awful. With one person working on it, they never happen. With a team they would.
  • Editors lag. A few tools choke on a file this large, and we edit with targeted find-and-replace more than by paging through it.
  • Load order matters. When a block moves to its own file, anything that needs it has to wait for it. We test the minified build, not only the readable one.

Would we do it again?

For an app run by one person, yes. The day a team works on it at once, we'd break it into parts.

The app is at https://arlts.org. Free, non-profit, no account needed.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.