News for hackers. Stuff that matters.
Re:jQuery 3.6.0 by ivosaur on Tuesday March 02, 2021 @03:09PM (#26319926)
> jQuery is ≈30k gziped and most likely already cached from CDN.

This part isn't so true in reality anymore, due to revised browser caching systems[1]. Doesn't mean you shouldn't use jQuery, just that part of the benefits of a centralized CDN are no longer a factor and it's a lot more sensible to self-host.

1: https://www.stefanjudis.com/notes/say-goodbye-to-resource-ca...

Re:jQuery 3.6.0 by tambourine_man on Tuesday March 02, 2021 @03:45PM (#26320392)
Right you are. But jQuery is around the same size as Vue, and that's the lean alternative to React. So the “jQuery is bloat” argument still doesn't make much sense.

A single retina hero banner is larger than most JavaScript libraries/frameworks.

Re:jQuery 3.6.0 by cultofmetatron on Tuesday March 02, 2021 @04:31PM (#26321115)
> and that's the lean alternative to React.

Ahem https://preactjs.com/

Re:jQuery 3.6.0 by xeromal on Tuesday March 02, 2021 @09:29PM (#26323984)
oh look, another one. lol
Re:jQuery 3.6.0 by junon on Wednesday March 03, 2021 @03:47AM (#26326095)
Re:jQuery 3.6.0 by lohfu on Sunday March 07, 2021 @11:26AM (#26377153)
vue.js came before preact, it was first released february 2014 https://blog.evanyou.me/2014/02/11/first-week-of-launching-a...
Re:jQuery 3.6.0 by srgpqt on Tuesday March 02, 2021 @04:20PM (#26320932)
A lean alternative to React would be preact.
Re:jQuery 3.6.0 by shard972 on Tuesday March 02, 2021 @08:32PM (#26323610)
Or mithril
Re:jQuery 3.6.0 by fragile_frogs on Wednesday March 03, 2021 @11:22AM (#26330521)
Or Inferno
Re:jQuery 3.6.0 by IA21 on Thursday March 04, 2021 @02:36AM (#26339734)
something something framework of the week
Re:jQuery 3.6.0 by cout on Tuesday March 02, 2021 @04:54PM (#26321475)
Vue is the lean alternative to Angular.
Re:jQuery 3.6.0 by tim333 on Wednesday March 03, 2021 @06:23AM (#26327018)
And you can swap Zepto for jQuery which is like 10k and has pretty much all the functionality apart from some ancient browser support.
Re:jQuery 3.6.0 by dangerbird2 on Tuesday March 02, 2021 @04:06PM (#26320730)
One thing that doesn't help jquery's case is that it and its plugin ecosystem isn't modular, making it impossible to trim the code size below the minified size via dead code elimination or even es6 partial imports. It would be nice to see more fluent DOM apis like jquery, but having 1st class support for es6 modules so you can import only the functionality you need in your final bundle
Re:jQuery 3.6.0 by brylie on Tuesday March 02, 2021 @05:41PM (#26322124)
ZeptoJS has a modular build tool, allowing you to select only the desired modules

https://zeptojs.com/

Re:jQuery 3.6.0 by arp242 on Tuesday March 02, 2021 @10:38PM (#26324436)
So does jQuery by the way; you can use some flags to grunt to enable/disable parts you don't want. The README has some docs on this.
Re:jQuery 3.6.0 by brylie on Tuesday March 02, 2021 @05:45PM (#26322177)
Re:jQuery 3.6.0 by SilverRed on Tuesday March 02, 2021 @07:29PM (#26323195)
The reality was you where almost never getting a cached version anyway. There are so many versions of jQuery in use over so many CDNs that the chance of a user already having the exact version and cdn that you use is almost nothing.
Re:jQuery 3.6.0 by 1123581321 on Tuesday March 02, 2021 @09:57PM (#26324174)
We looked into this several years ago and found that most of our users had likely encountered and cached the several most popular versions on CDNs. There was a power law distribution in effect.

In the last five years, the release schedule has slowed, so there was a convergence onto fewer versions in the wild, but at the same time, users were visiting fewer sites that used CDN versions (and fewer sites in general.)

Re:jQuery 3.6.0 by Sn0wCoder on Tuesday March 02, 2021 @04:09PM (#26320783)
Thanks for the article. I was just telling someone that jQuery was most likely already in the browser cache so don’t worry about it. Guess I need to go back and say I was wrong...
Re:jQuery 3.6.0 by franga2000 on Wednesday March 03, 2021 @05:18AM (#26326648)
There's still a huge benefit to using CDNs, despite caching being dead - they are almost certainly faster then whatever is hosting your site. If your site is relatively light and has a lot of traffic (especially international), pulling libs from a CDN could significantly increase the amount of requests you can process on the same server hardware and regardless of that, decrease the load latency for your users.
Re:jQuery 3.6.0 by stjohnswarts on Tuesday March 02, 2021 @09:54PM (#26324148)
considering the size of frameworks like react, it's basically a "nothing" download. I've seen people spend more bandwidth on rounded corners.
Re:jQuery 3.6.0 by cphoover on Tuesday March 02, 2021 @11:50PM (#26324896)
React with react-dom is like ~35kb gzipped
Re:jQuery 3.6.0 by sshb on Tuesday March 02, 2021 @03:54PM (#26320555)
Well, you are still getting less server load and faster response times across the globe, right?
Re:jQuery 3.6.0 by csswizardry on Tuesday March 02, 2021 @04:05PM (#26320712)
> …and faster response times across the globe, right?

Unfortunately not. There is no benefit to leaving your critical files on anyone else’s infrastructure: https://csswizardry.com/2019/05/self-host-your-static-assets...

Re:jQuery 3.6.0 by abhinav22 on Tuesday March 02, 2021 @05:25PM (#26321905)
As someone who is well experienced in web dev, that was a great article! Not so easy to find online, keep up the good work and I’ve become a fan
Re:jQuery 3.6.0 by csswizardry on Tuesday March 02, 2021 @07:05PM (#26323027)
Thank you!
Re:jQuery 3.6.0 by bcrosby95 on Tuesday March 02, 2021 @06:31PM (#26322694)
We used to use google.com for hosting jquery for us. Then when google.com started being blocked by the great firewall our site broke (it was pretty popular in China). It took a while to find out what went wrong, especially with the language barrier.

Back then we decided it's just better to self host. Less things can go wrong.