Live data from Hacker News

Drop jQuery as a dependency from Rails

github.com

41–50 of 123 posts

Re: Drop jQuery as a dependency from Rails

#41

Omakase implies a certain level of excellence in all the individual choices. I believe Rails is In-N-Out Burger. While it offers few choices, it's reliable and the hamburger is very good. The fries and frontend framework are acceptable but no one goes to In-N-Out for the fries.

Animal fries

Re: Drop jQuery as a dependency from Rails

#42
post #18

I never understood why rails has javascript helpers at all. It just does not bring any value in the long run, just complicates stuff. Rails should be js libraries agnostic and not provide any js related helpers out of the box in my opinion.

Concurred. I'd previously only used Rails for building out APIs to be used in combination with libraries/frameworks like React and Ember.js. I'm recently working on a full-stack Rails app that has frequent usage of "remote: true" and some JS magic for things to work "the Rails way". The Rails JS "magic" is sort of confusing/horrifying when actually working with it and I'm finding it the cause of mysterious bugs that are hard to debug. :/ Why they just didn't use AJAX for these remote forms, I don't know. But it's annoying to deal with.

Re: Drop jQuery as a dependency from Rails

#43

Earlier quoted context omitted.

This is one of the best things about Django - outside the admin interface it's not opinionated about your frontend setup.

Of course "not opinionated" in this case is an euphemism and really means that Django doesn't help you at all and so you have to suffer the incomplete and abandoned middleware of others to have something that resembles an asset pipeline. And that's actually odd, because both Rails and Django are frameworks born for building frontends to MySQL databases, which means these frameworks really are about HTTP 1.1 frontend…

Take away templates and add Django Rest Framework and you have a very capable platform for building large CRUD APIs complete with models, permissions, serializers and so forth.

Is it the best solution when you just want to stream data down a socket? No. That doesn't mean it's useless for many other things.

If I'm going down the SPA route I'd just build the frontend separately using ember-cli or webpack or some other "native" solution and forget any asset pipeline.

Re: Drop jQuery as a dependency from Rails

#44

Rails should stop messing with Javascript all together. Drop JQuery, CoffeeScript, TurboLinks and what not and let the users decide what to use, make it optional. Rails shouldn't require a JS engine in order to run.

Rails is a true example of an opinionated framework. So if you think this is the way to go, open an issue on github, bring out your ideas about how this change can help people and see if it works out.

Rails tries to set most of the best practises for you so that you don't need to make bad decisions on out-of-scope things. just focus on the actual problem. If you are well aware of how things are working and it doesn't fit you, then you can start with Sinatra or rewrite the parts that are not good in Rails.

But just saying Rails should drop JS doesn't doesn't add much unless you have a better solution.

Re: Drop jQuery as a dependency from Rails

#45
post #22

Earlier quoted context omitted.

The problem isn't jQuery, the problem is that 90% of the use cases for jQuery can now be solved with native APIs (or polyfills if compatibility with older browsers is a requirement). The main feature is basically element.querySelectorAll (or document.querySelectorAll for the global version). The XHR wrapper can easily be replaced with the fetch API. Class list manipulation is easy with element.classList. The event li…

> The XHR wrapper can easily be replaced with the fetch API. Browser support for fetch is still pretty weak, so you'll need some kind of polyfill to use it today. http://caniuse.com/#feat=fetch

Right. My argument is that you could fork the relevant subset of jQuery and own your own compatibility story in the event that Rails wants to push this on apps for some reason (I don't see the benefit of that).

An alternative would be to initiate a discussion with jQuery as obviously Rails isn't the only framework that's dealing with this issue. Let the jQuery guys do what they're great at, let Rails do what it does.

Re: Drop jQuery as a dependency from Rails

#46

Rails should stop messing with Javascript all together. Drop JQuery, CoffeeScript, TurboLinks and what not and let the users decide what to use, make it optional. Rails shouldn't require a JS engine in order to run.

Rails philosophy is a full stack framework. Not having to make decisions about your first web app is a huge draw to the framework.

Re: Drop jQuery as a dependency from Rails

#47
post #28
post #8

Earlier quoted context omitted.

So did you do JS development back in 2006 without jQuery?

The first few years I did PHP without much client side scripting. Then ExtJS, then a short stint with Ember and after that React.

What was your experience with Ext? I had to use it for a few years, and was never a huge fan. We ran into a lot of obscure bugs in their code which resulted in a number of hackaround "Ext.Overrides," and their support forums (Mitch Simmeons in particular) is a joke.

Re: Drop jQuery as a dependency from Rails

#48

Omakase implies a certain level of excellence in all the individual choices. I believe Rails is In-N-Out Burger. While it offers few choices, it's reliable and the hamburger is very good. The fries and frontend framework are acceptable but no one goes to In-N-Out for the fries.

Animal Fries!!!

Re: Drop jQuery as a dependency from Rails

#49
post #28

Earlier quoted context omitted.

The first few years I did PHP without much client side scripting. Then ExtJS, then a short stint with Ember and after that React.

What was your experience with Ext? I had to use it for a few years, and was never a huge fan. We ran into a lot of obscure bugs in their code which resulted in a number of hackaround "Ext.Overrides," and their support forums (Mitch Simmeons in particular) is a joke.

Which version did you use?

I only used ExtJS 4 and 4.1

I liked their API documentation and the xtypes that allowed for declarative Views. React reminded me of this later.

Post reply on HN