sanity-lighthouse-plugin
v1.1.1
Published
<img width="1295" alt="Sanity Lighthouse in use" src="https://github.com/Halo-Lab/sanity-lighthouse-plugin/assets/342951/4fa7137b-0e35-4370-9f5f-68de77cd99bc">
Downloads
27
Maintainers
Readme
Sanity PageSpeed Monitoring Plugin (for Sanity Studio v3)
This plugin is for Sanity Studio v3 and uses the PageSpeed Insights API 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.
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.
API key will 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:
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:
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 by Google to provide insights into website speed and performance.
Develop & test
This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.
See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.