Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zachleat/speedlify-score

A web component that shows Lighthouse scores via Speedlify.
https://github.com/zachleat/speedlify-score

speedlify web-components

Last synced: 12 days ago
JSON representation

A web component that shows Lighthouse scores via Speedlify.

Awesome Lists containing this project

README

        

# speedlify-score Web Component

* [I added Lighthouse Scores to my Site’s Footer and You Can Too](https://www.zachleat.com/web/lighthouse-in-footer/)
* Related blog post: [Use Speedlify to Continuously Measure Site Performance](https://www.zachleat.com/web/speedlify/)

## Demo

* [`` Demo](https://zachleat.github.io/speedlify-score/demo.html) using [speedlify.dev instance](https://www.speedlify.dev/)

## Usage

### Installation

```
npm install speedlify-score
```

### Include Sources

Include `speedlify-score.js` in your page (preferably concatenated in via a build script).

### Use Markup

Use `` in your markup.

Required attributes:

* `speedlify-url`: **Required**. The URL to your Speedlify instance.
* `hash`: **Preferred** but technically optional. A hash representing the active URL.
* Look this up via your Speedlify instance’s `/api/urls.json` file. [Full instructions available at this blog post](https://www.zachleat.com/web/lighthouse-in-footer/#adding-this-to-your-eleventy-site!).
* `url`: Optional. Not used if `hash` is supplied. This is the raw URL of the page you’d like to see the score for. Defaults to the current page.

#### Examples

```html

```

```html

```

#### Use Attributes to customize output

* If no attributes are used, it `score` is implicit and default.
* If some attributes are in play, you must explicitly add `score`.
* `requests`
* `weight`
* `rank`
* `rank-change` (difference between old and new rank)

## Changelog

* `v1.0.0`: First release
* `v2.0.0`: Changes default render behavior (only shows Lighthouse scores by default, summary and weight are not). Adds feature to use attributes to customize output if you want to opt-in to more.
* `v3.0.0`: Removes `flex-wrap: wrap` for top level component.
* `v4.0.0`: Using Shadow DOM, removes need for external stylesheet.