Tech Tip #7: Weigh your web page

We cut our home page from six point eight megabytes to one point seven.

Video created by explainapaper.com

The problem

Pages grow by accretion: a slider plugin here, a second copy of jQuery there, full-size images everywhere. Every visitor downloads all of it, on every first view.

The fix you can use today

  • Measure a first view: bytes and requests, with a real browser.
  • Remove scripts a page does not use and purge unused CSS.
  • Recompress images, serve WebP or AVIF, and lazy-load what is below the fold.

That is GreenCode's own website, measured before and after the rebuild.

Tools that help

  • Lighthouse: audits a page for total byte weight, unused JavaScript and CSS, image formats and offscreen images
  • WebPageTest: loads a real page and shows every request, its size and when it loaded
  • CO2.js (Green Web Foundation): an open-source library that turns bytes transferred into an estimate of CO2, using the Sustainable Web Design model

How GreenCode helps

GreenCode helps tackle this by practising it on greencode.ai: static pages, WebP images, scripts only where they are used and purged styles cut a first view of the home page from 80 requests to 33. More on this.

Tags

#web-performance#images#javascript#frontend

Sources

All GreenCode Tech Tips

  • Tip #7
  • For Developers
  • Category Web and front-end
  • Format short video
GreenCode

Want this checked on your own system? Talk to the GreenCode team.

Get in touch