Skip to content
SEO & Web⏱️ 13 min read·

Optimizing Core Web Vitals for Nepal's Mobile Networks: WebP, Font Subsetting & LCP Fixes

Learn how to optimize Largest Contentful Paint (LCP) and Cumulative Layout Shift (CLS) for budget Android phones and fluctuating 4G mobile data connections in Nepal.

MN
Manoj NeupaneSoftware Developer & Programming Instructor
#Performance#Core Web Vitals#Next.js#WebP#Nepal Mobile#PageSpeed
🎯 Who This Tutorial Is For

📋 Prerequisites
  • ✓A Next.js 14 or React web project
  • ✓Basic familiarity with Chrome DevTools Performance and Network tabs

🚀 What You Will Learn & Build

  • ▸Reduce bundle size by 60%+ using modern image formats and responsive picture sizing
  • ▸Eliminate Flash of Unstyled Text (FOUT) on slow mobile connections using font subsets
  • ▸Prevent layout shifts caused by dynamic banners and unreserved media slots
  • ▸Achieve 95+ mobile Lighthouse scores on real NTC and Ncell mobile networks
1

1. The Reality of Mobile Performance in Nepal

While developers in Kathmandu often test websites on high-speed fiber internet (WorldLink, Vianet, Subisu with 100+ Mbps), **over 70% of real Nepali website visitors browse on mobile devices using NTC or Ncell 4G data packs**. In real-world conditions outside Kathmandu valley—or even indoors in concrete buildings in Baneshwor or Lalitpur—mobile latency frequently spikes above **300ms**, and bandwidth drops to **1.5–3.0 Mbps**. When your website loads 4MB unoptimized PNG hero banners and un-subsetted Google fonts, pages take **8 to 12 seconds to load**, causing 60%+ bounce rates. ### Core Web Vitals Targets: - **LCP (Largest Contentful Paint):** $\le 2.5\text{s}$ (Time until main content renders). - **INP (Interaction to Next Paint):** $\le 200\text{ms}$ (Smooth response to clicks and taps). - **CLS (Cumulative Layout Shift):** $\le 0.1$ (Zero jarring screen jumps).
2

2. Crushing Largest Contentful Paint (LCP < 2.5s)

The hero banner is almost always the LCP element. In Next.js, follow these rules: 1. Use `priority` on the above-the-fold hero image. 2. Specify modern format conversions (AVIF / WebP) in `next.config.js`. 3. Provide accurate `sizes` attributes so mobile browsers never download 4K desktop assets.
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    formats: ['image/avif', 'image/webp'],
    deviceSizes: [640, 750, 828, 1080, 1200, 1920],
    imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
    minimumCacheTTL: 60 * 60 * 24 * 30, // 30 days cache for CDN edge
  },
};

module.exports = nextConfig;
3

3. Devanagari & Latin Font Subsetting (next/font)

Loading full multi-weight Google fonts like Mukta, Poppins, or Roboto can add 300KB+ of render-blocking CSS and font files. Use `next/font/google` with explicit **subsetting** and `display: 'swap'`:
src/app/fonts.ts
import { Inter, Mukta } from "next/font/google";

// Latin typography for code and English headings
export const inter = Inter({
  subsets: ["latin"],
  display: "swap",
  variable: "--font-inter",
});

// Devanagari typography for Nepali text
export const mukta = Mukta({
  weight: ["400", "600", "700"],
  subsets: ["devanagari", "latin"],
  display: "swap",
  variable: "--font-mukta",
});

✨ Expected Output & Verification

A high-performing Next.js application that achieves green Core Web Vitals across LCP, INP, and CLS on throttled mobile connections.

🧪 How to Test the Implementation

  1. 1Configure Slow 4G network throttling in Chrome DevTools Network tab
  2. 2Audit homepage using PageSpeed Insights and verify LCP < 2.5s
  3. 3Verify next/font subsetting delivers zero Flash of Invisible Text
  4. 4Check Cloudflare Edge cache headers (CF-Cache-Status: HIT)

⚠️ Common Errors & How to Fix Them

❌Image optimizer fails on Vercel: 'Source image exceeds max allowed size of 20MB'

Root Cause: Uploading raw DSLR camera photos directly into the /public folder.

Fix: Resize hero photos to a maximum width of 1920px and compress using Squoosh.app or Sharp CLI before committing to Git.

❌Google PageSpeed warns 'Ensure text remains visible during webfont load'

Root Cause: Custom fonts without display: 'swap' causing FOIT (Flash of Invisible Text).

Fix: Specify display: 'swap' in your font declaration so a fallback system font is displayed instantly until custom glyphs download.

🛡️ Security Considerations & Best Practices

  • !Ensure third-party script sources are explicitly whitelisted in your Content Security Policy (CSP) headers.

❓ Frequently Asked Questions (FAQ)

Yes! Cloudflare has Edge Points of Presence (PoPs) in Kathmandu (KTM) peering directly with major Nepali ISPs like WorldLink and NTC, reducing asset latency from 150ms+ to under 15ms.

📌 Summary of Key Takeaways

Optimizing Core Web Vitals for Nepal means prioritizing mobile 4G latency with Next.js priority hero images, AVIF/WebP compression, font subsetting, and lazy-loading third-party analytics.

Official References & Further Reading