GoogleChrome/lighthouse

Lighthouse GitHub Actions Status Badge Linux Build Status Coverage Status NPM lighthouse package
Lighthouse analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.

Using Lighthouse
Using Lighthouse in Chrome DevTools
Using the Chrome extension
Using the Node CLI
CLI options
Using the Node module
Viewing a report
Online Viewer
Docs & Recipes
Developing Lighthouse
Setup
Run
Tests
Docs
Associated Products and Projects
Lighthouse Integrations in Web Perf services
Lighthouse Integrations in non-Web Perf services
Plugins
Related Projects
FAQ
How does Lighthouse work?
Can I configure the lighthouse run?
How does Lighthouse use network throttling, and how can I make it better?
Are results sent to a remote server?
How do I author custom audits to extend Lighthouse?
How do I contribute?
Using Lighthouse in Chrome DevTools
Lighthouse is integrated directly into the Chrome DevTools, under the “Lighthouse” panel.

Installation: install Chrome.

Run it: open Chrome DevTools, select the Lighthouse panel, and hit “Generate report”.

Lighthouse integration in Chrome DevTools

Using the Chrome extension
The Chrome extension was available prior to Lighthouse being available in Chrome Developer Tools, and offers similar functionality.

Installation: install the extension from the Chrome Web Store.

Run it: follow the extension quick-start guide.

Using the Node CLI
The Node CLI provides the most flexibility in how Lighthouse runs can be configured and reported. Users who want more advanced usage, or want to run Lighthouse in an automated fashion should use the Node CLI.

Lighthouse requires Node 10 LTS (10.13) or later.

Installation:

npm install -g lighthouse

or use yarn:

yarn global add lighthouse

Run it: lighthouse https://airhorner.com/

By default, Lighthouse writes the report to an HTML file. You can control the output format by passing flags.

CLI options
$ lighthouse --help

lighthouse

Logging:
–verbose Displays verbose logging [boolean]
–quiet Displays no progress, debug logs or errors [boolean]

Configuration:
–save-assets Save the trace & devtools log to disk [boolean]
–list-all-audits Prints a list of all available audits and exits [boolean]
–list-trace-categories Prints a list of all required trace categories and exits [boolean]
–print-config Print the normalized config for the given config and options, then exit. [boolean]
–additional-trace-categories Additional categories to capture with the trace (comma-delimited).
–config-path The path to the config JSON.
An example config file: lighthouse-core/config/lr-desktop-config.js
–budget-path The path to the budget.json file for LightWallet.
–chrome-flags Custom flags to pass to Chrome (space-delimited). For a full list of flags, see
http://peter.sh/experiments/chromium-command-line-switches/.

                             Environment variables:
                             CHROME_PATH: Explicit path of intended Chrome binary. If set must point to an executable of a build of
                             Chromium version 66.0 or later. By default, any detected Chrome Canary or Chrome (stable) will be launched.
                                                                                                                                   [default: ""]

–port The port to use for the debugging protocol. Use 0 for a random port [default: 0]
–preset Use a built-in configuration. [choices: “experimental”, “perf”]
WARNING: If the --config-path flag is provided, this preset will be ignored.
–hostname The hostname to use for the debugging protocol. [default: “localhost”]
–max-wait-for-load The timeout (in milliseconds) to wait before the page is considered done loading and the run should continue.
WARNING: Very high values can lead to large traces and instability [default: 45000]
–emulated-form-factor Controls the emulated device form factor (mobile vs. desktop) if not disabled [choices: “mobile”, “desktop”, “none”] [default: “mobile”]
–enable-error-reporting Enables error reporting, overriding any saved preference. --no-enable-error-reporting will do the opposite. More:
https://git.io/vFFTO
–gather-mode, -G Collect artifacts from a connected browser and save to disk. If audit-mode is not also enabled, the run will quit
early. [boolean]
–audit-mode, -A Process saved artifacts from disk [boolean]

Output:
–output Reporter for the results, supports multiple values [choices: “json”, “html”, “csv”] [default: “html”]
–output-path The file path to output the results. Use ‘stdout’ to write to stdout.
If using JSON output, default is stdout.
If using HTML or CSV output, default is a file in the working directory with a nam

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值