7 ms·
> 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
by ivosaur 6y ago
> 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-caching-across-sites-and-domains/ https://www.stefanjudis.com/notes/say-goodbye-to-resource-ca...
- tambourine_man 6y agoRight 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.
- srgpqt 6y agoA lean alternative to React would be preact.
- shard972 6y agoOr mithril
- fragile_frogs 6y agoOr Inferno
- IA21 6y agosomething something framework of the week
- cultofmetatron 6y ago> and that's the lean alternative to React. Ahem https://preactjs.com/ https://preactjs.com/
- xeromal 6y agooh look, another one. lol
- junon 6y ago> another one Preact [0] came before Vue [1]. [0] https://github.com/preactjs/preact/commits/master?after=605bc5ec8804f031d9bbeff33d41c8c15ca13df5+4830&branch=master https://github.com/preactjs/preact/commits/master?after=605b... [1] https://github.com/vuejs/vue/commits/dev?after=5255841aaff441d275122b4abfb099b881de7cb5+3135&branch=dev https://github.com/vuejs/vue/commits/dev?after=5255841aaff44...
- lohfu 6y agovue.js came before preact, it was first released february 2014 https://blog.evanyou.me/2014/02/11/first-week-of-launching-an-oss-project/ https://blog.evanyou.me/2014/02/11/first-week-of-launching-a...
- cout 6y agoVue is the lean alternative to Angular.
- tim333 6y agoAnd you can swap Zepto for jQuery which is like 10k and has pretty much all the functionality apart from some ancient browser support.
- sshb 6y agoWell, you are still getting less server load and faster response times across the globe, right?
- csswizardry 6y ago> …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/ https://csswizardry.com/2019/05/self-host-your-static-assets...
- abhinav22 6y agoAs 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
- csswizardry 6y agoThank you!
- bcrosby95 6y agoWe 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.
- dangerbird2 6y agoOne 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
- brylie 6y agoZeptoJS has a modular build tool, allowing you to select only the desired modules https://zeptojs.com/ https://zeptojs.com/
- arp242 6y agoSo 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.
- brylie 6y agoCash supports partial builds: https://github.com/fabiospampinato/cash/blob/master/docs/partial_builds.md https://github.com/fabiospampinato/cash/blob/master/docs/par...
- Sn0wCoder 6y agoThanks 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...
- SilverRed 6y agoThe 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.
- 1123581321 6y agoWe 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.)
- stjohnswarts 6y agoconsidering the size of frameworks like react, it's basically a "nothing" download. I've seen people spend more bandwidth on rounded corners.
- cphoover 6y agoReact with react-dom is like ~35kb gzipped
- franga2000 6y agoThere'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.