Question:
I’m struggling with making a Perfect score page, using Google’s Lighthouse API. I don’t want to watch a YouTube video as it feels like the coding aspect is gone. I’d much rather ask fellow developers directly.
I don’t currently have code as I just want to learn the basics of it from somebody. If you have time and are willing to help, I will appreciate it!
It’s important to know what each part of this means and what solution is the most viable. For example, eliminate render block is doing something to prevent CSS from blocking rendering. You can use media queries to mark some CSS resources as non-render-blocking. Here’s an example:
media="print" marks the stylesheet as non-critical (since “print” stylesheets don’t block rendering), and onload="this.media='all'" changes it to be used for all media once it has loaded.
Accessibility would be using semantic HTML elements, associated labels in form elements and a good color contrast.
Best Pratices is the same as always:
Using https protocol
All links having rel=noopener
All libraries updated to the last version
All page content inside the <main> element
btw, rel=noopener prevents other pages from manipulating your page. For example:
<a href="https://example.com" target="_blank" rel="noopener">This is a safe Replit link</a>