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
Generate a JSON report and print it
Generate a JSON report and save it to a specific file
Generate a report using the browser in headless mode without logging to stdout
Generate a report, using the HTTP header key/value pairs in the specified JSON file for all requests
Generate a report for specific categories only
Generate a report with device emulation and all throttling disabled
Display help
SYNOPSIS
npx lighthouse
PARAMETERS
--output
Specify the output format for the report (e.g., html, json, csv).
--output-path
Define the file path where the generated report will be saved.
--view
Automatically open the generated HTML report in your default web browser.
--preset
Set the device preset for the audit, affecting viewport and user agent.
--throttling-method
Choose how network and CPU throttling is applied during the audit.
--chrome-flags="--headless --no-sandbox"
Pass custom command-line flags to the Chrome browser instance used for auditing.
--help
Display a comprehensive help message with all available command-line options.
--version
Show the current installed version of Lighthouse.
DESCRIPTION
Google Lighthouse is an open-source, automated tool designed to improve the quality of web pages. It runs a series of audits against a given URL, covering key aspects like performance, accessibility, best practices, search engine optimization (SEO), and progressive web app (PWA) capabilities. Upon completion, Lighthouse generates a detailed report, providing scores for each category and actionable suggestions for improvement. While not a native binary in standard Linux distributions, it's widely used by web developers and SEO specialists on Linux systems via Node.js's package runner, `npx`. This allows seamless integration into development workflows, continuous integration pipelines, and local testing environments. Lighthouse helps ensure that websites are fast, user-friendly, and adhere to modern web standards, making them more discoverable and enjoyable for end-users. It's an essential utility for anyone focused on optimizing web presence.
CAVEATS
lighthouse
requires Node.js and npm (or `yarn`) to be installed on your Linux system. It's executed via `npx` (Node Package Execute) rather than being a standalone compiled binary found in typical system paths like `/usr/bin`.
Audits can be resource-intensive, especially for complex pages, consuming significant CPU and memory. Performance results can vary slightly between runs due to network conditions or system load.
AUDIT CATEGORIES
Lighthouse reports are structured into several categories, including Performance, Accessibility, Best Practices, SEO, and Progressive Web App. Each category provides a score and detailed suggestions for improvement.
INTEGRATION WITH CI/CD
Lighthouse can be integrated into Continuous Integration/Continuous Delivery (CI/CD) pipelines to automate web performance and quality checks, preventing regressions and ensuring consistent web vitals.
HISTORY
Lighthouse was developed by Google and first released in 2016, primarily focusing on Progressive Web App (PWA) audits. Over time, its capabilities expanded significantly to include performance, accessibility, best practices, and SEO. It became a core part of Chrome DevTools in version 60, making it readily available to web developers. Its continuous development aims to keep pace with evolving web standards and best practices, providing a crucial tool for modern web development.