How to embed files hosted on Github

Is there no solution, where i can add my custom scripts to the CDN of Webflow? Just to avoid some more HTTP requests? Or is Webflow already using HTTP 2?

You can’t host your own JavaScript files on the Webflow CDN. But you can use the page custom code, or custom code elements to add your JavaScript straight into your project.

Yeah, i know. But i’m not a fan of a lots of inline javascript and multiple resources loaded. Thats why i asked if there is maybe a Webflow Javascript Function to push certain resources to their CDN. Would be a useful feature. But i think its the performance matters are too small to have such a feature.
I mean 2 CDN instead of one is still not the best solution :slight_smile:

Not sure if it still works, but I’ve done it before. You can upload a text file to your assets, then load that file.

1 Like

how do you do that ? i tried getting the url of my text assets but it doesn’t work.

my text url is something like this

https://uploads-ssl.webflow.com/5fbbd8b04100e910e2dbf903/5fc3b27ee4b22271e37ae5cd_webflow%20text.txt

Any update on this? Doesn’t appear to work anymore.

1 Like

Hi @samliew!

Is it possible to make fill="currentColor" work with this method? I’ve tried implementing the gist code via Combinatronics and it works but the currentColor feature doesn’t.

I want to utilize Webflow’s text color as a way to change SVGs color. It works if I use the code inside Webflow but obviously, I’m using the method with GitHub because SVGs I’m trying to add are exceeding Webflow’s 10K character limit.

Thank you in advance for a reply, Sam!

@jkshilling sorry it’s a late reply to that thread but it might be helpful for people looking for it in future.

So if your raw link looks like this:

[(https://raw.githubusercontent.com/GitUser/ProjectName/Branch/JS-File.js)]

You can change it to:

[(https://cdn.jsdelivr.net/gh/GitUser/ProjectName@Branch/JS-File.js)]

Hope that helps. Cheers

1 Like

I’ve tried linking to my HTML file and haven’t had any luck with the embed. The conversion to combinatronics format works great, but I can’t get webflow to render anything. Am I missing something while embedding this? Thanks in advance.

Here’s the raw file: https://combinatronics.com/daviddejongdesign/18da2042f1fd7851075408bac493e07d/raw/c306c3317b8b4f1edceec3f756895e13ad0b7d04/activecampaign.form.optin.html

Read-only link: Webflow - Anugreh Sapra's Marketing Website

Guys, struggeling with a githubcontent whatever online URL is hard, try to export your site with https://stacket.app and then easily add javascript files in your repository without any limits like https://www.knguru.de/js/script.js .

Then just link your script for example script src=“mydomain.com/js/script.js”>

Not only easier, but also very good for SEO.

@Daviddj - HTML can’t be embedded this way. This topic is about including JS from GitHub which should be done by using jsDelivr.

Hi Jeff,

I followed all instructions and have included this in the Footer Code at site level: <script src="https://cdn.jsdelivr.net/gh/Silvan33y/96c364267dc47d46ab92ca5b4dc7ede6/raw/d0da1e2cc59d264c23709af059ef51785ac36ab9/darkmode-jquery.min.js"></script>

And this is the raw link: https://gist.githubusercontent.com/Silvan33y/96c364267dc47d46ab92ca5b4dc7ede6/raw/d0da1e2cc59d264c23709af059ef51785ac36ab9/darkmode-jquery.min.js

But it doesn’t load the dark mode function on my website: https://silvansoeters.webflow.io/

Could you please take a look at this?

Thank you very much.

Best,
Silvan

@Silvan_Soeters1 - Scripts should only include code. Not script tags (HTML). You can’t load HTML this way.

Thank you Jeff. It’s working now!

Hello Jeff, i’ve tried to embed an html file from github repository using jsDeliver cdn but is not working like the css file. could you please help? i’m a newbie :confused:
i placed this embeded
…( raw link: https://raw.githubusercontent.com/jhosuer24/wwd/main/watch.html )

https://preview.webflow.com/preview/wwd-1e6681?utm_medium=preview_link&utm_source=dashboard&utm_content=wwd-1e6681&preview=6dbe2c72330237364320bc0ce311f230&workflow=preview

@Josh_GRM - What you are trying to do is not possible inside of a web page without using JavaScript.

A post was split to a new topic: Custom code using external script issue