LinuxCommandLibrary

lighthouse

Audit website performance and accessibility

TLDR

Generate an HTML report for a specific website and save it to a file in the current directory

$ lighthouse [https://example.com]
copy

Generate a JSON report and print it
$ lighthouse --output [json] [https://example.com]
copy

Generate a JSON report and save it to a specific file
$ lighthouse --output [json] --output-path [path/to/file.json] [https://example.com]
copy

Generate a report using the browser in headless mode without logging to stdout
$ lighthouse --quiet --chrome-flags="[--headless]" [https://example.com]
copy

Generate a report, using the HTTP header key/value pairs in the specified JSON file for all requests
$ lighthouse --extra-headers=[path/to/file.json] [https://example.com]
copy

Generate a report for specific categories only
$ lighthouse --only-categories=[performance,accessibility,best-practices,seo,pwa] [https://example.com]
copy

Generate a report with device emulation and all throttling disabled
$ lighthouse --screenEmulation.disabled --throttling-method=[provided] --no-emulatedUserAgent [https://example.com]
copy

Display help
$ lighthouse --help
copy

SYNOPSIS

lighthouse URL [options]

PARAMETERS

--output=FORMAT
    Output format: html, json, csv (can combine)

--output-path=PATH
    Output file path

--view
    Open HTML report in browser after run

--chrome-flags=FLAGS
    Custom Chrome flags

--port=PORT
    Chrome debugging port

--preset=NAME
    Use preset configuration (desktop, perf, experimental)

--only-categories=CAT
    Run only specified categories

--skip-audits=AUDITS
    Skip specified audits

--throttling-method=METHOD
    Network throttling method

--form-factor=TYPE
    Device form factor (mobile, desktop)

--screenEmulation.disabled
    Disable screen emulation

-A, --max-wait-for-load=MS
    Maximum page load wait time

DESCRIPTION

Lighthouse is an open-source automated tool for improving the quality of web pages. It audits pages for performance, accessibility, progressive web app capabilities, SEO, and best practices. Lighthouse can be run from the command line, as a Chrome extension, or programmatically as a Node module.

CAVEATS

Requires Chrome/Chromium installed. Results can vary between runs due to network conditions. Some audits may not apply to all page types. Large pages may timeout with default settings.

AUDIT CATEGORIES

Performance - Load speed and responsiveness
Accessibility - WCAG compliance
Best Practices - Web development standards
SEO - Search engine optimization
PWA - Progressive Web App capabilities

SEE ALSO

chromium(1), node(1), pagespeed(1)

Copied to clipboard