Kirby Size Inventory

@jenstornell A file stored on a CDN is stored in multiple servers across the globe, and will be served to the requesting browser by the closest available server. By storing a copy of a framework or library in your own server, you are not making delivery easier or faster for your server - you are doing the opposite. You are overloading your server with load requests that could be easily delivered by this other distributed network. They key feature of CDNs is, therefore, that they are more reliable and faster than just delivering everything using your own private server.

With this in mind, I don’t understand your concerns in regards to loading jQuery and FontAwesome “on every single page of the Panel”. If they are required on every single page load of the Panel, then it will be better to load them off CDN than from your own private server (faster, and less load requests to your own server).

In regards to programming without an internet connection, I ask you to consider how often - and for how long - you’ve done that, during the last 5 years. Even if you have all of your project’s resources available locally, chances are you’ll still need to logon to consult online docs, reference sites, search for available plugins and libraries, get support, etc. Even if you do a little work offline, that is temporary, and you’ll need to go online soon enough before you can finish any part of what you’re doing.

So, if you consider that at most you might be programming offline for, let’s say, less than 10% of the time, the question then becomes whether it’s worthwhile sacrificing the performance of the site, and substantially increasing the size of the project, because of that…

In my workplace, it is a RULE that if a framework/library/resource is available via CDN, we MUST use it from CDN, every single time. The benefits of doing this have proven themselves to us multiple times, and we now indeed consider bad coding practice to include these frameworks/libraries in the project, if they are already available via CDN.

I have actually developed an intranet site with Kirby. The intranet was completely offline, 100 % of the time, because it was portable.

That doesn’t mean at all that I didn’t have internet while developing the site. But the users didn’t.

@lukasbestle That’s exactly the kind of rare project where it DOES make sense to include a full copy of all frameworks and libraries, instead of using a CDN!

Yeah, and that’s why the Panel shouldn’t use CDNs by default. Being independent is always great. But maybe there could be an option to use CDNs instead if the user really wants to.

I agree of course with the points for a CDN being made that delivery across the globe is going to be much faster and more reliable. But I would still never go for a CDN hosted js library or font for the panel. There are two major reasons.

The first reason is that I don’t want to make the decision for users if they like to be tracked. For example if I would include Source Sans Pro from Google Webfonts, I have no control what they do in the background in order to analyize the traffic generated by loading the fonts from their CDN. Most users might not have an issue with that but some might.

The second reason is a more practical one. I’m often working on client projects when I’m on a train or in a location without wifi. Having a local installation, which always relies on internet access would be a no go for me personally.

7 Likes

I would also always prefer local hosted copies of the panel assets, because of privacy concerns. As long, as your panel is not accessed from different parts of the world every day, the performance should be a minor issue. A good solution could be, to serve from your own server by default with an option, to server from a different domain, i.e. the CDN provider of your choice.

A few others have already mentioned it, but seriously. Drop jQuery, you won’t regret it!

People tend to use jQuery because it’s all they know. I was guilty of it too until recently. My first vanilla JS campaign site, for Mazda, resulted in a tiny 13kb JS bundle that managed to handle waypoints, a touch slider, 360deg rotator, HTML5 video, hash routing, everything. I have learned a lot since then and can do even better now.

  • You remove a massive dependancy that has to be managed.
  • jQuery is BIG! Usually much bigger than the actual application code. That has to be downloaded before your app can run, and if it’s cached it still has to be parsed.
  • Vanilla JS is dramatically more performant.
  • Error traces are much clearer because everything doesn’t get routed through 6 internal jQuery steps.
  • The syntax is much cleaner, there are less $ and () going on and you don’t need to track whether variables are jQuery objects or not.
  • Googling is much easier because you are not limited to jQuery solutions.
  • You will be able to understand better and contribute to non jQuery projects (the majority and the future of web).

On the CDN thing, please don’t. It’s better to only have small dependancies and bundle it all up. CDN doesn’t make sense with HTTP/2. Also, I do offline dev all the time. For example, write blog posts in train tunnels and on flights.

1 Like

The main advantages of jQuery for Kirby are:

  • It fixes a lot of browser-specific issues, which is often neglegted by people who say working without jQuery is better.
  • The barrrier for entry for plugin/widget developers is lower. It doesn’t make any sense if every plugin included jQuery again.
1 Like