https://github.com/halo-lab/sanity-lighthouse-plugin
https://github.com/halo-lab/sanity-lighthouse-plugin
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/halo-lab/sanity-lighthouse-plugin
- Owner: Halo-Lab
- Created: 2023-02-14T09:32:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T13:09:10.000Z (almost 2 years ago)
- Last Synced: 2025-04-09T22:07:42.625Z (about 1 year ago)
- Language: JavaScript
- Size: 3.02 MB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sanity Lighthouse Plugin (for Sanity Studio v3)
> This plugin is for Sanity Studio v3 and uses the [PageSpeed Insights API](https://developers.google.com/speed/docs/insights/v5/about) to provide insights into the speed and performance of your website. To use this plugin, you will need to have an API key for the PageSpeed Insights API.

## Get your credentials here
To use the PageSpeed Insights API, you will need to obtain an API key. You can get your API key by following the instructions provided in the [PageSpeed API documentation](https://developers.google.com/speed/docs/insights/v5/get-started#APIKey).
Additionally, if you use Gmail for your Google account, you may need to generate an app password to use as your API key. Instructions for generating app passwords can be found in [Google's support documentation](https://support.google.com/accounts/answer/185833).
API key allow the Sanity Page Speed plugin to access the PageSpeed Insights API and provide speed and performance insights for your website.
## Installation
> To install this plugin, use the following command:
```sh
npm install sanity-lighthouse-plugin
```
## Usage
> To use this plugin, add it as a plugin in your `sanity.config.ts` (or .js) file, as shown in the example below:
```ts
import {defineConfig} from 'sanity'
import {lighthousePlugin} from 'sanity-lighthouse-plugin'
export default defineConfig({
// ...
plugins: [lighthousePlugin()],
})
```
After adding the plugin, you can access it by opening the "Page Speed" tab in the Sanity Studio.
On this page, you'll need to enter the API key you generated (as described above) within the modal window.
After that, you can enter the URL of the page you want to analyze and click "Run Analysis" to get insights into the speed and performance of your website.
## Acknowledgments
This plugin uses the [PageSpeed Insights API](https://developers.google.com/speed/docs/insights/v5/about) by Google to provide insights into website speed and performance.
## Develop & test
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.