Hacker News new | ask | show | jobs
by Etheryte 1748 days ago
While this is technically interesting, I can't help but ask what the benefit of this is? Instead of using a library that's battle-tested and well documented you'll now have to maintain an ad hoc replacement with unknown unknowns. Cutting down your bundle size is a good goal, but this feels like much too steep of a tradeoff.
2 comments

There is a trend in web dev right now to stop using jQuery because reasons. These reasons make sense if you use a framework and sometimes need to venture outside of it.

The problem is that the reasons are not often understood and then a tool like this comes along and now we can easily replace jQuery with a worse API adapter. Hooray!

The repo says it is for lightGallery, which is trying to offer a framework-agnostic lightbox component. Modern JS setups simply don't play nice with jquery.min.js, and it's a big download and hard to slice up. This helps folks reuse more old work like lightGallery. That's a pretty good reason, almost the best possible reason to build this, I think.

How it will likely be used is a different matter -- if you're a company trying to hire young devs and don't like to admit you have any legacy tech in the stack, then this is HOT code right now. Same if you need some bullshit targets to hit before the end of the quarter. Get on it!

I do feel the move against jquery comes from people that surpass it, which seems a shame. They had to use it once. It's like burning the rope for the people behind. Many low level users don't care about 30kb to get the $ shorthand as it's a habit they've had for a decade. It's funny almost to see the hoops people jump through not to use it. Like having a point to prove and not being able to prove it. Hey look, you can replace jquery with these 10 unmemorable esoteric steps.
> There is a trend in web dev right now to stop using jQuery because reasons.

One reason is that a lot of jquery’s bulk is compatibility concerns or BC in edges, if you decide that you don’t support old jQuery (mis)behaviour, older APIs, older browsers, … you can probably slim it down a fair bit.

A bunch of utilities you can also probably do without e.g. your jQuery.map, animations stuff, … jQuery is progressively deprecating more and more things, but it’s a harder sell to actually remove them.

Like I said, all the reasons for removing jQuery are valid, but only in the context of the codebase where they are given.

You wouldn't want to remove jQuery from an app that is used by IE9.

People end up hearing the reasons and don't stop to think, hey does this actually apply to my code? What are the trade offs for that 30k of code?

Many just end up rewriting what jQuery did in a non reusable way that contributes to code bloat and bad readability.

I guess it might be useful as a first step if you want to reduce your dependencies on jQuery. First use this so you can drop the dependency, then slowly replace the functions you're using.