Skip to content

An automatic CDN service for Web polyfills, which is based on TypeScript, Node.js & JSDelivr.

Notifications You must be signed in to change notification settings

EasyWebApp/Web-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web polyfill

An automatic CDN service for Web polyfills, which is based on TypeScript, Node.js & JSDelivr.

CI & CD

Usage example

  1. Find a Web feature in the Polyfill directory
  2. Copy the class name of the selected polyfill, then write it into a specific Script URL (shown below)
  3. the above script will detect whether current environment needs to be patched, then load the polyfill script original from JSDelivr

Web pages

<head>
    <script src="https://polyfill.web-cell.dev/feature/ResizeObserver.js"></script>
</head>

Web workers

self.importScripts('https://polyfill.web-cell.dev/feature/Regenerator.js');

Add more polyfills

  1. For junior engineers, you can submit an issue and wait for the maintainer reaction
  2. For senior engineers, just edit the Polyfill files, and make a pull request
  3. After your pull request reviewd & merged, the polyfills will be updated by GitHub actions automatically

Host your own mirror

  1. Fork this repository
  2. Replace original HTTP domain with yours in GitHub action configuration
  3. You can replace GitHub pages with an Object Storage service (AWS S3, etc.)

China mainland

Thanks for KaiYuanShe's donation, we get a fast local mirror for China mainland:

https://polyfill.kaiyuanshe.cn/

Custom examples

Edit .env content to fit your situation:

WAN_ICON=🇺🇦
WAN_HOST=https://polyfill.example.ua
LAN_ICON=🇷🇺
LAN_HOST=https://polyfill.example.ru

or

WAN_ICON=🇰🇷
WAN_HOST=https://polyfill.example.kr
LAN_ICON=🇰🇵
LAN_HOST=https://polyfill.example.kp

Inspired by

  1. https://polyfill.io/
  2. https://polyfiller.kaiyuanshe.cn/