Giter Site home page Giter Site logo

pengzhanbo / caniuse-embed Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 798 KB

Embed the CanIUse compatibility table in your site

Home Page: https://caniuse-embed.vercel.app

License: MIT License

JavaScript 1.82% TypeScript 45.89% Astro 29.26% CSS 23.03%
astro caniuse ssr caniuse-embed

caniuse-embed's Introduction

CanIUse Embed

Embed up-to-date data from caniuse.com and mozilla's browser compat data.

Displays feature support data for multiple versions of the 10 major browsers.

Configurable, reliable, and fully responsive.

Document

See Documention for more details.

Usage

Include the following javascript file in your document.

<script type="module" src="https://caniuse-embed.vercel.app/embed.js"></script>

Paste this snippet where you want the embed to be displayed:

<p class="ciu-embed" data-feature="{feature}" data-past="2" data-future="3" data-meta="be6d"></p>

Example

example

Why ?

In the past, I often embedded CanIUse data in my technical documents using https://caniuse.bitsofco.de/. However, I found that when embedding it, it required loading @mdn/browser-compat-data (14MB) and caniuse/full-data.json (4MB), totaling over 18MB of data, and then needed to be parsed at runtime, resulting in less than 10kb of effective data.

This consumes too much traffic and seriously affects loading speed!

Therefore, I decided to redevelop using Astro and deploy to Vercel.

By using Astro SSR, a completely independent static page is generated for each feature without requesting any data, and each page is no more than 20kb in size!

At the same time, using Vercel's ISR capability, new pages are regenerated and cached as static files every 7 days to ensure data freshness without the need for redeployment.

Reddit

LICENSE

MIT

caniuse-embed's People

Contributors

lruihao avatar pengzhanbo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

lruihao

caniuse-embed's Issues

缺少部分必要的样式

.ciu-embed {
  iframe {
    display: block;
    width: 100%;
    border: none;
  }
}

不然 iframe 的宽度不回撑满 100%。

image

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.