You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
Copy file name to clipboardExpand all lines: README.md
+47-27Lines changed: 47 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,24 @@
2
2
3
3
A Netlify plugin to generate a Lighthouse report for every deploy
4
4
5
-
## Usage
5
+
## Installation options
6
6
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)
8
15
9
16
### Install plugin through the Netlify UI
10
17
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).
12
19
13
-
### Install plugin through the`netlify.toml` file
20
+
### Install plugin with a`netlify.toml` file
14
21
15
-
You can also install it manually:
22
+
To install the plugin manually:
16
23
17
24
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`.
18
25
@@ -66,23 +73,7 @@ You can customize the behavior via the `audits` input:
66
73
performance = 0.8
67
74
```
68
75
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:
@@ -104,18 +95,45 @@ The Lighthouse report results are automatically printed to the **Deploy log** in
104
95
2:35:17 PM: }
105
96
```
106
97
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:
108
105
109
106
```
110
107
[[plugins]]
111
108
package = "@netlify/plugin-lighthouse"
112
109
113
110
[plugins.inputs.settings]
114
111
preset = "desktop" # Optionally run Lighthouse using a desktop configuration
115
-
locale = "es" # Any Lighthouse-supported locale, used to generate reports in a different language
116
112
```
117
113
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
119
137
120
138
Fork and clone this repo.
121
139
@@ -126,9 +144,11 @@ yarn install
126
144
yarn local
127
145
```
128
146
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.
130
150
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.
132
152
133
153
<imgwidth="1400"alt="Deploy view with Lighthouse visualizations"src="https://user-images.githubusercontent.com/79875905/160019039-c3e529de-f389-42bc-a3d4-458c90d59e6a.png">
0 commit comments