Skip to content

Commit 4072838

Browse files
jmarlenajackbrewernasivuela
authored
Add support for Desktop device, other languages, and some other clarity tidying (#477)
* Generalize intro beyond Lighthouse report * Not sure what "Usage" means exactly so ✂️ it * Improve visibility & rationales for installation options Add new structure here with links to new sections * Adding the 2 options at the top of this section * UI installation recap * Verbify headers * Move example to its own section * Add draft versions of new sections * Refine language examples * More refinements * Some reframing * Standardize headers and order * minor qualification for file-based installation * Remove "build" here to reduce nouns and cognitive processing load for newer users * Apply suggestions from code review Co-authored-by: Jack Brewer <[email protected]> * Apply Jack's input to add locale l"ist" * Apply header reframe here Co-authored-by: Nasiba Carrasco Lanchas <[email protected]> * Apply suggestions from code review * Remove multi-site-path support * Add general line about config options * Revise desktop device section * Revise locale section Co-authored-by: Jack Brewer <[email protected]> Co-authored-by: Nasiba Carrasco Lanchas <[email protected]>
1 parent 145d1e0 commit 4072838

File tree

1 file changed

+47
-27
lines changed

1 file changed

+47
-27
lines changed

README.md

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
A Netlify plugin to generate a Lighthouse report for every deploy
44

5-
## Usage
5+
## Installation options
66

7-
If you would like to run the Lighthouse build plugin for multiple site paths, such as for the site root path and a contact page, we recommend installing the build plugin manually in the `netlify.toml` file.
7+
You can install the plugin for your site using your `netlify.toml` file or the Netlify UI.
8+
9+
For the most customization options, we recommend installing the Lighthouse plugin with a `netlify.toml` file.
10+
11+
`netlify.toml` file-based installation allows you to:
12+
- [Run Lighthouse audits for different site paths, such as the contact page and site home page](#run-lighthouse-for-different-site-paths)
13+
- [Run Lighthouse audits for a desktop device](#run-lighthouse-for-the-desktop-experience)
14+
- [Generate Lighthouse results in a language other than English](#generate-lighthouse-results-in-other-languages)
815

916
### Install plugin through the Netlify UI
1017

11-
You can install this plugin in the Netlify UI from this [direct in-app installation link](https://app.netlify.com/plugins/@netlify/plugin-lighthouse/install) or from the [Plugins directory](https://app.netlify.com/plugins).
18+
For UI-based installation, you can install this plugin from the [Integrations Hub](https://www.netlify.com/integrations/lighthouse/), the [Plugins directory](https://app.netlify.com/plugins), or through this [direct installation link](https://app.netlify.com/plugins/@netlify/plugin-lighthouse/install).
1219

13-
### Install plugin through the `netlify.toml` file
20+
### Install plugin with a `netlify.toml` file
1421

15-
You can also install it manually:
22+
To install the plugin manually:
1623

1724
From your project's base directory, use npm, yarn, or any other Node.js package manager to add the plugin to `devDependencies` in `package.json`.
1825

@@ -66,23 +73,7 @@ You can customize the behavior via the `audits` input:
6673
performance = 0.8
6774
```
6875

69-
Example `netlify.toml` file that audits the site root path and a contact page:
70-
71-
```
72-
[[plugins]]
73-
package = "@netlify/plugin-lighthouse"
74-
75-
# Generate a Lighthouse report for the site's root path
76-
[[plugins.inputs.audits]]
77-
path = ""
78-
79-
# Generate a Lighthouse report for the contact site path
80-
[[plugins.inputs.audits]]
81-
path = "contact"
82-
83-
```
84-
85-
The Lighthouse report results are automatically printed to the **Deploy log** in the Netlify UI. For example:
76+
The lighthouse scores are automatically printed to the **Deploy log** in the Netlify UI. For example:
8677

8778
```
8879
2:35:07 PM: ────────────────────────────────────────────────────────────────
@@ -104,18 +95,45 @@ The Lighthouse report results are automatically printed to the **Deploy log** in
10495
2:35:17 PM: }
10596
```
10697

107-
We currently support the following settings, which are passed directly to Lighthouse:
98+
## Lighthouse plugin configuration options
99+
100+
To customize how Lighthouse runs audits, you can make changes to the `netlify.toml` file.
101+
102+
### Run Lighthouse audits for desktop
103+
104+
By default, Lighthouse takes a mobile-first performance testing approach and runs audits for the mobile device experience. You can optionally run Lighthouse audits for the desktop experience by including `preset = "desktop"` in your `netlify.toml` file:
108105

109106
```
110107
[[plugins]]
111108
package = "@netlify/plugin-lighthouse"
112109
113110
[plugins.inputs.settings]
114111
preset = "desktop" # Optionally run Lighthouse using a desktop configuration
115-
locale = "es" # Any Lighthouse-supported locale, used to generate reports in a different language
116112
```
117113

118-
## Running Locally
114+
Updates to `netlify.toml` will take effect for new builds.
115+
116+
To return to running Lighthouse audits for the mobile experience, just remove the line `preset = "desktop"`. New builds will run Lighthouse for the mobile experience.
117+
118+
### Generate Lighthouse results in other languages
119+
120+
By default, Lighthouse results are generated in English. To return Lighthouse results in other languages, include the language code from any Lighthouse-supported locale in your `netlify.toml` file.
121+
122+
For the latest Lighthouse supported locales or language codes, check out this [official Lighthouse code](https://github.com/GoogleChrome/lighthouse/blob/da3c865d698abc9365fa7bb087a08ce8c89b0a05/types/lhr/settings.d.ts#L9).
123+
124+
Updates to `netlify.toml` will take effect for new builds.
125+
126+
#### Example to generate Lighthouse results in Spanish
127+
128+
```
129+
[[plugins]]
130+
package = "@netlify/plugin-lighthouse"
131+
132+
[plugins.inputs.settings]
133+
locale = "es" # generates Lighthouse reports in Español
134+
```
135+
136+
### Run Lighthouse Locally
119137

120138
Fork and clone this repo.
121139

@@ -126,9 +144,11 @@ yarn install
126144
yarn local
127145
```
128146

129-
## Lighthouse Score Visualizations (Labs feature)
147+
## Preview Lighthouse results within the Netlify UI
148+
149+
Netlify offers an experimental feature through Netlify Labs that allows you to view Lighthouse scores for each of your builds on your site's Deploy Details page with a much richer format.
130150

131-
When you install the [Lighthouse Build Plugin](https://app.netlify.com/plugins/@netlify/plugin-lighthouse/install) on your site and enable this experimental feature, you can view the Lighthouse scores for each of your builds on your site's Deploy Details page with a much richer format.
151+
You'll need to install the [Lighthouse build plugin](https://app.netlify.com/plugins/@netlify/plugin-lighthouse/install) on your site and then enable this experimental feature through Netlify Labs.
132152

133153
<img width="1400" alt="Deploy view with Lighthouse visualizations" src="https://user-images.githubusercontent.com/79875905/160019039-c3e529de-f389-42bc-a3d4-458c90d59e6a.png">
134154

0 commit comments

Comments
 (0)