Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Audit a Page With Lighthouse

Before the garden site goes online, you run Lighthouse on it with all four categories, and sort every finding it reports: fix it, or explain why you’re leaving it.

Key Points

  • Run all four categories. Open the page in Chrome, open DevTools, and pick the Lighthouse panel. Leave Performance, Accessibility, Best Practices and SEO ticked, keep the device on Mobile, and click Analyze page load. Lighthouse reloads the page and writes a report. The garden’s home page scores 100 in all four.
  • An accessibility 100 means every check Lighthouse scores has passed, not that every visitor can use the page. The report still lists ten items to check by hand.
  • Performance is one estimated load. Its score weighs five timings from one load instead of counting passed checks. The report’s footer says how it loaded the page: a single page session, on an emulated Moto G Power with slow 4G. Under the score, the report says “Values are estimated and may vary.” A real phone on a real network can be slower.
  • SEO checks that a description exists. The audit called Document has a meta description passes because the head has one. It can’t tell whether that description would make anyone click. A description that says only “Home page” passes too. Judging it is your job.
  • A 100 doesn’t mean an empty report. Under Performance, Lighthouse lists insights, some with an estimated saving. They don’t lower the score. For each one, decide: fix it, or explain, in a note to yourself, why you’re leaving it. On the home page:
  • Use efficient cache lifetimes is about how long a browser may reuse a file, and the compression line in Document request latency is about squeezing text before it’s sent. The server sets both, so your HTML can’t change them. Explain them as the host’s job, and recheck once the site is online.
  • Render-blocking requests names style.css. The page needs it to draw, and it’s one small file. Explain.
  • Two insights show no estimate. LCP request discovery, the insight about finding the main photo, wants it marked high priority, but it’s in the HTML and not lazy-loaded, so the browser finds it early. Network dependency tree has only the page and one stylesheet. Explain both. If the photo shows up late on a real phone, mark it then.
  • Improve image delivery says plot 7’s photo is 800 pixels wide. It takes 380 CSS pixels on the screen, and this phone packs 1.75 screen pixels into each, so it needs 665 image pixels. The srcset offers no size in between, so the browser took the next one up. Explain.
  • The same insight’s two compression rows suggest stronger compression: 32.4 KiB on plot 7’s photo and 11.9 KiB on the tool shed’s JPEG. They’re small savings on a small site, so explain them.
  • The seed swap page has real fixes. It scores 98 for Performance, 96 for Best Practices and 91 for SEO:
  • Its photo is 1200 pixels wide, for a space that needs 665, and its <img> has no srcset. There’s no smaller file for the browser to choose, so a phone downloads about 190 KiB more than it needs. Fix.
  • SEO reports no meta description. Best Practices logged a console error: the page has no icon link, so the browser asked for the default /favicon.ico and got a 404. Lighthouse reports the error, not the icon itself. Both are fixes in the page’s head.
  • The project has you fix or explain every finding on every page.
  • The rule: a Lighthouse score sums up one load: timings for Performance, automated checks for the rest. Sort every finding: fix it, or explain why you’re leaving it. Then check what Lighthouse can’t: use the page with only the keyboard and with a screen reader, read your descriptions and alt text, and try a real phone once the site is online.

Final Code

No code changes in this lesson. The seed swap page’s photo, the one Lighthouse sorts as a fix, as it stands in events/seed-swap.html:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 The garden’s home page now describes itself in its head, with a description, an icon and a share card. Before the site goes online, you’ll check it with Lighthouse, the tool you once ran for accessibility alone.

00:13 In this video, you’ll run all four of its categories, and decide what each finding means for a small site like the garden’s.

00:22 Lighthouse is a panel in Chrome’s DevTools. Leave every category ticked: Performance, Accessibility, Best Practices, and SEO. Keep the device on Mobile, and click Analyze page load.

00:36 Lighthouse reloads the page and writes a report. The home page scores 100 in all four.

00:45 You’ve read an accessibility 100 before. It means every check Lighthouse scores has passed, not that every visitor can use the page, and the report still lists ten items to check by hand.

00:58 Performance’s score isn’t a count of checks: it weighs five timings from one load. The footer says it ran a single page session, on an emulated Moto G Power with slow 4G.

01:09 Under the score, it says values are estimated and may vary. A real phone on a real network can be slower.

01:19 SEO has the same limit. The audit called Document has a meta description passes, because the head has one. It can’t tell whether that description would make anyone click.

01:28 A description that says only Home page passes too. Judging it is your job.

01:36 A hundred doesn’t mean an empty report. Under Performance, Lighthouse lists insights, some with an estimated saving. They don’t lower the score. For each, decide: fix it, or explain, in a note to yourself, why you’re leaving it.

01:53 Cache lifetimes say how long a browser may reuse a file. Compression squeezes text before it’s sent. The server sets both, so your HTML can’t change them. Explain them as the host’s job, and recheck once the site is online.

02:09 The render-blocking insight names your stylesheet. The page needs it to draw, and it’s small. Explain.

02:18 Two insights show no estimate. The insight about finding the main photo wants it marked high priority, but it’s in the HTML and not lazy-loaded, so the browser finds it early.

02:29 The dependency tree has one stylesheet. Explain both. If the photo shows up late on a real phone, mark it then. The insight called Improve image delivery says plot 7’s photo is 800 pixels wide.

02:44 It takes 380 CSS pixels on the screen, and this phone packs 1.75 screen pixels into each, so it needs 665 image pixels. No size sits in between, so the browser took the next one up.

02:58 Explain.

03:01 Now run Lighthouse on the seed swap page. Performance drops to 98, Best Practices to 96, and SEO to 91. The seed swap photo is 1200 pixels wide, for a space that needs 665, and its tag has no srcset.

03:19 Fix or explain? Your turn: pause the video and predict. Fix. There’s no smaller file for the browser to choose, so a phone downloads about 190 KiB more than it needs.

03:35 SEO reports no meta description. Best Practices logged a console error: with no icon link on this page, the browser asked for favicon.ico and got a 404.

03:47 Lighthouse reports the error, not the icon. Both are fixes in the page’s head. The project has you sort every finding on every page.

03:57 So a Lighthouse score sums up one load: timings for Performance, automated checks for the rest. Sort every finding: fix it, or explain why you’re leaving it.

04:09 Then check what Lighthouse can’t: use the page with only the keyboard and with a screen reader, read your descriptions and alt text, and try a real phone once it’s online.

04:20 Next, in Publish on GitHub Pages, you’ll put the garden site online.

Become a Member to join the conversation.