Why the static assets are not hosted in free CDN?

5 replies · opened Apr 28, 2020

WwffrestApr 28, 2020

It is rather painful with all the tons of generic css, js and font files that are rather big 100's K's.

Now I'm not a n00b and I was able to CDN source myself and I am a pioneer when it comes to serving content thru HTTP.

However for typical users of these templates,

Why don't you pile them (or fonts/CSS/JS) in some Git repo and serve them thru CDN as a distribution channel?

There are public CDNs which allow hot linking with even release specific tags to lock in specific assets to fixed version e.g. template version.

Some of these CDNs even minimise JS automatically on the fly and provide very good compression thru Gzip.

I don't see anyone wanting to modify jQuery or Bootstrap which btw have CDN distribution which could be linked.

And even if someone in remote case wants custom version of whatever they will just host it themselves or throw it to Github and CDN it.

Also benefit of CDN is that most ISPs have POPs to allow minimal latency.

I already CDNised all my static assets but I would like to see proper use of template distribution which makes my job much easier integrating these assets and use em in more sites as it was easy to integrate.

On my project also I currently have 40+ assets total on a very simple web page and while Chrome by it's own limitation loads only six same time with a latency of 100ms each makes total load time longer than I would like - typical problem with heavy small asset JS/CSS sites which there is limited improvements I can obtain VS low hanging tree with CDN and compression and ensuring loaded assets are small. Automatic dependency management would be really nice that builds the actual used css, js etc in but now that happening with modern web developers in general is remote looking at Node.JS modules directories lol

WwffrestApr 28, 2020

Also the benefit of CDN is, we can do dependency injection very easily, either from centralised point or local.

With static assets e.g. if we load css/foobar.css it always loads from where ever the browser was pointed at first time loading the main html.

Where as say it's imaginary https://rawgitcdn.com/user/repository@[releasetag|master]/css/foobar.css we can easily inject that asset.

Most people who use these templates are hooked into internet and those assets will get cached locally so there isn't too much harm using remote resource vs storing them locally and copying around dependencies.

Also another benefit of having them in CDN like that is we can hotlink directly to specific release(s) of template(s) and if needed we can serve them locally if needed - for advanced users should do this anyways since most hosting is billed by bandwidth.

Let's say egress traffic out of web hosting is billed at 0.01$ @ 1GB the cost say for 3MB (average?) website load for 1000 unique users per month is 30$ without Encoding: Gzip and with encoding Gzip it's going to be 15$ roughly assuming 50% compression.

With CDN if you put 2.9MB of assets to some release-tagged public repository (these assets are visible in people's websites anyways) on front of free CDN

You will save 10K template users * 15-30$ = 150k-300k per month.

Considering it would be quite easy to CDN a lot of those assets without paying a penny and where benefits trump the downsides....

I mean who really needs jQuery and fonts stored locally?

WwffrestApr 28, 2020

Looks like I spotted a bug in your website, left bracket characters converts to hex %5B ?

[[[[[

SSemicolon WebSTAFFApr 28, 2020

Hello,

We absolutely understand your concerns regarding this and agree with you, however, the Package Guidelines requires us to include the assets in the Package that are being used in the Files. Additionally, it is also somewhat better, as then the User can use the Template offline or can use some builder softwares like Dreamweaver. Otherwise they start becoming slow when using external assets. Also, it is up to the user, how would they like to use the assets available, whether on a CDN or on their Website's Server. So, this appears to be okay at the moment considering user experience.

Nonetheless, we will definitely look into this possibility in the Future Updates of Canvas if this is the way to go forward.

Let us know if we can help you with anything else or if you find any further issues.

WwffrestApr 29, 2020

That's understandable and thanks for taking this into consideration -

Maybe I could flick you the shell script(s) that does sed// like for CDN versions across which you could include in your optimisation section.

I am sure you are aware there are free reliable and now-standard CDN's which relay anything that is in GitHub with no extra effort/cost?

e.g. by pointing anything on jsDelivr (I use it for all CSS/JS and some other versioned assets):

https://cdn.jsdelivr.net/gh/user/repository@master/

Or version-lock with branch:

https://cdn.jsdelivr.net/gh/user/repository@branch/

jsDelivr uses multiple CDNs (like five) and use AWS S3 as static object cache and highly reliable even if anything goes down between, way more reliable than any homebrew VPS.

RawGit used to be one but has some other alternatives as well https://rawgit.com/

There is also bootstrapcdn which distributes bootstrap - e.g.

https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css

Also jQuery has CDN version:

https://code.jquery.com/jquery-3.5.0.min.js

If you are willing to put some of the big generic files to github - e.g. the CSS and other JS where you combine some functions it would help a lot of users to switch more easily to CDN as the files are already there ready to be pointed at during deployment which can run simple sed// script e.g. in Dockerfiles

Also would you agree that it is important for the n00b web designer to notice the performance issues early at the design phase as a lot of people only notice the large images when copying the files to the webhost that doesn't do much like Gzip/minimifying.

I mean if the static asset is optimised and from reliable CDN it shouldn't matter most of the time esp the ones who we can provide easy switch to make it painfree without everyone having to implement their own CDN solution even though CloudFlare has free tier.

SSemicolon WebSTAFFApr 30, 2020

Hello,

Absolutely agreed! And this is some valuable of information. We have already forwarded all your Tips to Our Dev Team. We will definitely get in touch with you when we plan to implement these changes to the Template in the Future Updates. And we Thank You for these amazing suggestions.

Meanwhile, do let us know if we can help you with anything else or if you find any issues with Canvas.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard