GithubHelp home page GithubHelp logo

ankurparihar / readme-pagespeed-insights Goto Github PK

View Code? Open in Web Editor NEW
189.0 5.0 31.0 187 KB

Google lighthouse stats of your website that you can put in readme

Home Page: https://pagespeed-insights.herokuapp.com

License: Apache License 2.0

JavaScript 3.98% TypeScript 96.02%
pagespeed-insights readme lighthouse-audits svg

readme-pagespeed-insights's Introduction

PageSpeed Insights for README

Embed your website's pagespeed score to your readme

About PageSpeed Insights

PageSpeed Insights analyzes the content of a web page, then generates suggestions to make that page faster. Learn more.

Info

Guages

PWA

API and Usage

Important note: Do not embed url to readme, instead embed generated svg

  • It takes time to perform audits of website. So embedding it directly in readme would not render due to server timeout. Instead you must first visit and download the svg from the api (by simply visiting api url with desired parameters). And then embed that svg to your README files.
  • Typically it takes 10-15 seconds to obtain the results from pagespeed api
  • Some servers don't allow (eg. google.com) or delay (eg. cloudflare) pagespeed crawler, so it may result in unexpected results.
  • The result may fluctuate slightly sometimes.

API url

The api is called from https://pagespeed-insights.herokuapp.com

Simple usage

In simple form it will return result for all categories for desktop version of your website. Replace your_website_url with your website's url

https://pagespeed-insights.herokuapp.com?url=your_website_url

For example

https://pagespeed-insights.herokuapp.com?url=https://ankurparihar.github.io

Theme

Default result is theme-agnostic i.e. looks good in both light and dark environment. But you can force one of two additional themes that are light and dark.

https://pagespeed-insights.herokuapp.com?url=your_website_url&theme=dark

Strategy

Strategy specifies the type of device your website is audited for. You can specify strategy as either mobile or desktop. If none is specified desktop is chosen

https://pagespeed-insights.herokuapp.com?url=your_website_url&strategy=mobile

Category

There are 5 categories (in order)

Category Name param
Performance performance
Accessibility accessibility
Best Practices best-practices
SEO seo
Progressive Web App pwa

If not specified, all the categories are evaluated. But you can specify only categories which you want to evaluate. The category parameter is comma-separated category indicators.

Examples:

Only performance

https://pagespeed-insights.herokuapp.com?url=your_website_url&categories=performance

All but PWA

https://pagespeed-insights.herokuapp.com?url=your_website_url&categories=performance,accessibility,best-practices,seo

Ordering

Order of categories is preserved

https://pagespeed-insights.herokuapp.com?url=your_website_url&categories=seo,performance,accessibility

Options

Additional options you can specify in query parameter

Name (default) Description
perfTestCount (1) Specify how many times performance test to run

Embedding into readme

After downloading svg you can embed into readme as following

  • markdown method
![alt text](path/to/svg "tooltip text")
  • html method
<p align="center">	<!-- (optional) center align -->
    <img src="/path/to/svg" width="XXXpx">
</p>

Keep results updated with action workflow

Example

readme-pagespeed-insights's People

Contributors

ankurparihar avatar dependabot[bot] avatar jezorko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

readme-pagespeed-insights's Issues

CLI, docker and ease of use improvements with `psi-svg`

I really liked the project and thank you for your work but the scope of the program did not fulfill all my requirements. I therefore went ahead and created a fork of this repo which implements a bunch of improvements to code quality and usability. Maybe you would like to check it out and tell me what you think? I was very careful to adhere to the license of your project, but please message me if anything is not in order.

Here is a link: https://github.com/nico-i/psi-svg

Add background-agnostic theme

The light / dark themes are awesome but I think a background-agnostic theme could be preferred by some.

I've modified the output SVG a bit to make that happen, here's how it looks like

2020-08-10 17-40-57

Left column is current light theme output on both light and dark background. Right column is SVG with my improvements.

You can find the modified SVG and a simple page I used to display both images here. Use diff to see the changes (:

Better error handling

Cases like

  • Invalid or absent URL
  • Invalid category, theme, strategy
  • PageSpeed API failure

Create a UI

Make a UI where people can submit website URL and download the SVG

Allow multiple tests for performance score

The performance score changes from test to test, so we should run this test multiple times (3-5) and average the perf score.

Ref: Why your score fluctuates

  • Allow user to send a param perfTestCount to specify number of time perf test to run.
  • Implement the feature in backend
  • Have a maxPerfTestCount in backend to prevent abuse of the feature.

Better portability

Make it easy to use by other account

  • Easy to host
  • Easy to integrate gitlab action to any project

Feature to allow ordering of svgs

Currently the order of SVGs is fixed to - perf, a11y, best-practices, seo and pwa.

Allow users to specify the order from categories param.

Proposed URL to specify widgets

https://service.host/?url=<URL>&categories=perf,seo,a11y => should render in this order [perf, seo, a11y]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.