Skip to content
GraphiCore
Development GraphiCore editorial

Less JavaScript — a faster site

Interactivity is justified where it is indispensable. Everywhere else it only gets in the way.

An orange pastel abstraction of circles and thin lines

A static page should not ship a library to the visitor just to open an accordion. Whether a script is justified is checked with a simple question: can this be done without it?

What usually does not need JS

  • Page blocks and their layout.
  • Switching images with <picture>.
  • Expanding details — with the native <details> element.
  • Forms — with native validation and attributes.

What does need it

  • Switching the theme before rendering — a short inline script.
  • The mobile menu panel with focus management.
  • Widgets that have no native equivalent.

What to measure

The size of the JS bundle on the page and the time to first painted content. On a multi-page site the saving adds up: the visitor does not download the same script again on every route.

If a page works without JS, that is not “almost working”. It already works.

  • performance
  • frontend