Skip to content

Instantly share code, notes, and snippets.

@jcubic
Last active November 13, 2024 22:56
Show Gist options
  • Save jcubic/a8b8c979d200ffde13cc08505f7a6436 to your computer and use it in GitHub Desktop.
Save jcubic/a8b8c979d200ffde13cc08505f7a6436 to your computer and use it in GitHub Desktop.
How to setup a literally free CDN
@3kh0
Copy link

3kh0 commented Feb 5, 2023

@proudparrot2
Copy link

Add gitloaf: https://gitloaf.com

@lopugit
Copy link

lopugit commented Jan 11, 2024

Wow this is so cool πŸ’―πŸ™πŸ™ŒπŸš€πŸ‘¨β€πŸ’»

@lopugit
Copy link

lopugit commented Jan 11, 2024

Would be great if there was a way to do cache busted @latest..

@jcubic
Copy link
Author

jcubic commented Jan 11, 2024

@lopugit there is an option to purge the URL for jsDelivr, but it doesn't work all the time. Just Replace the "cdn" with "purge".

You can try to add a GitHub action that will purge the URL. But it may break, it's better to do this manually. There is also an option to use git commit hash so you will always have the latest version.

@lopugit
Copy link

lopugit commented Feb 13, 2024

@jcubic oh awesome! πŸ™

Man, thank you so much for making this gist, this github -> cdn thing has helped me so much, if you use babel standalone, you can basically create full React typescript apps and make them embeddable using just <script src , combined with importing esm modules via esm cdn, it's incredible

          await loadScript("https://unpkg.com/@babel/standalone/babel.min.js", "text/javascript")
          
          await loadScript({ content: `
          
            import React from "https://esm.sh/react@18";
            window.React = React

Take a look here for example.

https://github.com/lopugit/mods/blob/v1.0.16/maccas.js

@jcubic
Copy link
Author

jcubic commented Feb 13, 2024

@lopugit I don't understand what your code is supposed to do, but I'm glad that you find my gist useful.

@lopugit
Copy link

lopugit commented Feb 13, 2024

@jcubic πŸ˜‚ πŸ™ πŸ’― πŸš€ πŸ‘

@Mugane
Copy link

Mugane commented Jun 21, 2024

Is it actually free though? Isn't Github (or whoever) paying for the service? Isn't this a violation of their terms of use?

@jcubic
Copy link
Author

jcubic commented Jun 21, 2024

@Mugane Sorry I'm not a lawyer. But this has nothing to do with GitHub, JSDelivr is donated to the public, all services give the service are donated to community. JSDelivr don't pay the Cloudflare bill.

@Mugane
Copy link

Mugane commented Jun 21, 2024

Ah, yes you are right. Neat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment