Giter Site home page Giter Site logo

ruddra / cloudflare-google-fonts-cache Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 6 KB

Use Cloudflare worker cache to serve google fonts.

Home Page: https://ruddra.com/cloudflare-cache-google-fonts/

License: MIT License

JavaScript 100.00%
cloudflare-workers

cloudflare-google-fonts-cache's Introduction

Cloudflare Worker for Google Fonts CDN Masking and Caching

This worker can be used to mask google font CDN with your own domain, so that you don't have to call or preconnect to google fonts from your html. Also, we are using worker cache to store the responses, so that we can make the calls faster.

How it works

Basically if you point your domain ie https://domain.com/fonts/* to this worker, then you should be able to get responses just like google CDN. For example: https://domain.com/fonts/css2?family=Roboto:wght@400;700&display=swap is same as https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap. Simillarly https://domain.com/fonts/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2 actual font file ie woff2 file) is same as https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2.

Contribute

Feel free to create a PR for any improvements.

License

MIT

cloudflare-google-fonts-cache's People

Contributors

ruddra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.