Lighthouse CLI Audit

Workflow

  1. Prefer the project’s local server instructions over ad hoc host tooling. For Docker Compose Jekyll repos, check the service before auditing:
docker --version
docker compose version
docker compose ps
docker compose up -d
docker compose logs --no-color --tail=220 jekyll
  1. Audit the local URL, not the production URL, unless the user explicitly asks for deployed results. For this repository the local URL is normally:
http://127.0.0.1:8080/
  1. Save reports under lighthouse_results/ with a clear name that includes viewport and date/context. Keep both HTML and JSON when possible.

  2. Run mobile and desktop separately. Use --chrome-flags="--headless --no-sandbox" in containerized or restricted environments. Use --only-categories=performance,accessibility,best-practices,seo unless the task requires all categories.

Commands

Use npx lighthouse if Node dependencies are available or if npx can download Lighthouse. If network is restricted and Lighthouse is already installed locally, prefer the local binary.

Mobile:

mkdir -p lighthouse_results
npx lighthouse http://127.0.0.1:8080/ \
  --emulated-form-factor=mobile \
  --screenEmulation.mobile=true \
  --screenEmulation.width=390 \
  --screenEmulation.height=844 \
  --screenEmulation.deviceScaleFactor=3 \
  --throttling-method=simulate \
  --only-categories=performance,accessibility,best-practices,seo \
  --chrome-flags="--headless --no-sandbox" \
  --output=html --output=json \
  --output-path=lighthouse_results/localhost_8080-mobile-current

Desktop:

mkdir -p lighthouse_results
npx lighthouse http://127.0.0.1:8080/ \
  --preset=desktop \
  --only-categories=performance,accessibility,best-practices,seo \
  --chrome-flags="--headless --no-sandbox" \
  --output=html --output=json \
  --output-path=lighthouse_results/localhost_8080-desktop-current

Always state the final command actually used, especially if Lighthouse version differences require flag adjustments.

Reading Results

Use JSON for precise summaries:

node -e 'const r=require("./lighthouse_results/localhost_8080-mobile-current.report.json"); for (const [k,v] of Object.entries(r.categories)) console.log(k, Math.round(v.score*100)); for (const id of ["first-contentful-paint","largest-contentful-paint","total-blocking-time","cumulative-layout-shift","speed-index"]) console.log(id, r.audits[id]?.displayValue);'

Report the category scores, FCP, LCP, TBT, CLS, Speed Index, total transfer size when relevant, and the top actionable audits. Do not paste large Lighthouse JSON or HTML into the answer.

Interpretation Rules