The Observation

The site was built on a template, and the template's main script leaned on a JS library plus three helper plugins, about 79KB in all. A performance audit suggested replacing them with the browser's built-in intersection observer and some CSS. Before removing anything, I checked every script on the site for code that called the library. Only one file did: the template's own script.

So the real question was not what the library did. It was what that one script did, and how much of it was still doing anything at all.

What Was Underneath

The bulk of it was scroll-reveal animation, which moved to a few lines of plain script without any visible change. The rest was a different story. There was a layout fix for a browser retired years ago, and a fallback for an image feature every current browser already supports. There was also a gallery lightbox.

The lightbox only opened when a gallery link pointed to an image file. Every link in the gallery pointed to an outside website. The lightbox had never opened, not once, and never could have. Its close-on-Escape handler listened for an event current browsers don't send for that key, so even if it had opened, that part would not have worked either.

The Fix That Fixed Nothing

The day before, an earlier audit had flagged the lightbox's placeholder image for having an empty source attribute. That got fixed, carefully, so the source was only set when the lightbox opened. It was a correct fix to a feature that would never run. Nobody asked whether the lightbox worked, because nothing about it looked broken. It was just there, next to a large dependency that made everything around it look busy.

Why It Stays Hidden

Dead code rarely throws errors. It loads, it attaches its listeners, and it waits for a condition that never comes. A library makes that easier to miss, because the library is clearly in use, and it is natural to assume everything built on top of it is too. Take the library away, and every line that depended on it has to justify itself again.

After the rewrite, the library and its plugins came out entirely, about 79KB, and the main script became about 1.6KB of plain code. Screenshots of every page before and after matched.

What to Watch

Any site built on a template is carrying features someone else thought it might need. Some of them are working. Some of them are waiting on markup that never showed up. Before trusting that a piece of code is live, check that the thing it responds to actually exists on the page. A feature with no way to trigger it is not a feature. It is weight.

Check What the Library Holds Up.

Cleanup like this is part of our web and digital work.

Get a Site Review