optional:swap:Async & Defer,Lazy Loading: Preloading: Prefetching:fallback:CSS Optimization:Code Splitting & Bundling: Code splitting:Optimize JavaScript code:Lazy loading non-critical resources=1.dynamic import2. custom image component 3. Lazy Load:Utilize web workers:Using better rendering methods:
Optimize font=1Next.js automatically optimizes fonts 2.Optimize fonts
Fonts are part of the critical rendering path of a website, and they can affect the load times of websites. Poorly optimized fonts can affect Core Web Vitals like Cumulative Layout Shift (CLS) and Largest Contentful Paint (LCP).
We can fix render-blocking fonts by preloading them and providing fallbacks.
this code we have to pase just down the head👇
HTML
Copy
<head>
https://fonts.googleapis.com/css2?family=Poppins;display=swap;otherparam=value
</head>
Copy
<head>
https://fonts.googleapis.com/css2?family=Poppins;display=swap;otherparam=value
</head>
this code 👇you have to paste just below body{
HTML
Copy
body {
font-family: 'Poppins', sans-serif;
}
/* Other elements using Poppins */
h1, h2, h3 {
font-family: 'Poppins', sans-serif;
}
/* then add the font declaration in the external stylesheet */
@font-face {
font-family: "Nunito", sans-serif;
font-style: normal;
font-weight: 400;
font-display: optional;
}
Copy
body {
font-family: 'Poppins', sans-serif;
}
/* Other elements using Poppins */
h1, h2, h3 {
font-family: 'Poppins', sans-serif;
}
/* then add the font declaration in the external stylesheet */
@font-face {
font-family: "Nunito", sans-serif;
font-style: normal;
font-weight: 400;
font-display: optional;
}
Progressive Enhancement aur Lazy Loading dono hi web development mein istemal hone wale techniques hain, lekin dono ka focus aur implementation thoda alag hota hai.
Progressive Enhancement:
Focus: Is technique ka focus hota hai user experience ko enhance karna, starting from a basic functional version, phir usme features aur enhancements add karke improve karna.
Implementation: Progressive Enhancement mein, aap shuruwat mein simpler version ya baseline functionality ko load karte hain. Phir, modern browsers ya devices ke liye enhancements, additional styles, ya functionalities ko gradually add karte hain.
Lazy Loading:
Focus: Lazy Loading ka focus hota hai webpage ki initial loading time ko kam karna. Is technique mein, aap images, videos, ya other resources ko load hone se pehle defer karte hain, specifically jab wo initial viewport ke bahar hote hain.
Implementation: Lazy Loading mein, aap sirf wo content load karte hain jo user immediate view mein hai ya use kar raha hai. Ye technique initial webpage load time ko reduce karke performance ko improve karta hai.
Toh antar yeh hai ki Progressive Enhancement user experience ko overall improve karne ke liye hai, jabki Lazy Loading specifically initial loading time ko kam karne ke liye focused hai. Progressive Enhancement mein gradual enhancements add kiye jaate hain, jabki Lazy Loading mein content ko defer kiya jaata hai jo immediate view se bahar hai.
muje vo sabhi rule chahiye hai jo google insite ke error ko hata sake
Google PageSpeed Insights errors ko fix karne ke liye kuch common techniques aur best practices hain jo aapki website ki performance ko improve kar sakte hain:
Optimize Images: Images ko compress karein, appropriate format (like WebP) ka istemal karein, lazy loading implement karein aur image sizes ko optimize karein.
Minify CSS, JavaScript, HTML: Files ko minify karein taki unka size kam ho, aur unhe ek hi file mein combine karein jahan possible ho.
Browser Caching: Static resources ko browser cache mein store karke repeat visits ke liye load time ko kam karein.
GZIP Compression: Server se data transfer karte waqt GZIP compression ka istemal karein jisse resources ke size ko kam kiya ja sake.
Eliminate Render-Blocking Resources: Critical CSS ko inline karein, ya phir asynchronously load karein taki rendering speed improve ho.
Reduce Server Response Time: Server response time ko kam karne ke liye optimize backend processes, server configurations aur database queries.
Optimized Hosting & CDN: High-performance hosting ka istemal karein aur Content Delivery Network (CDN) ka use karein taki resources ko users ke nazdeek servers se serve kiya ja sake.
Avoid Excessive Redirects: Multiple redirects se bachein, jo loading time ko slow kar sakte hain.
Prefetching & Preloading: Future navigation ke resources ko preload karein, aur critical resources ko prefetch karein taki unhe advance mein load kiya ja sake.
Error Handling & Graceful Degradation: Error handling implement karein taki agar koi resource load nahi hoti to user ko friendly message mile, aur older browsers ke liye graceful degradation provide karein.
Ye techniques Google PageSpeed Insights ke errors ko fix karne mein madadgar ho sakte hain, lekin yaad rahe har website ke liye har situation mein sabhi techniques suit nahi karti, isliye aapko apne specific context aur requirements ke hisab se inme se appropriate techniques choose karni hogi.
4 common pitfalls(nuksaan) that affect (prabhavit karte hai) the main thread
1Poorly optimized CSS files
2Bloated third-party resources
3Expensive JavaScript Operations
4Client-side rendering
Comments
Post a Comment