Live data from Hacker News

Drop jQuery as a dependency from Rails

github.com

91–100 of 123 posts

Re: Drop jQuery as a dependency from Rails

#91
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.

You have to look at in context; Rails got started in ~2006, long before you could do everything in JS, and its purpose was to enable you to build a web app from top to bottom.

At a glance, I don't think you can really claim that the JS frontend world is mature or stable, so in the meantime muddling-along seems equally valid.

Re: Drop jQuery as a dependency from Rails

#92
post #27

Earlier quoted context omitted.

Sure, except in this case the Rails defaults are totally at odds with how the larger JS ecosystem has evolved. CoffeeScript was basically the logical complement to Haml (Ruby-like syntax for HTML) and Sass (Ruby-like syntax for CSS) -- although Sass has since dropped its original syntax and moved on with the CSS-like SCSS. Since then CS has lost a lot of popularity outside the Rails community. Babel and TypeScript pr…

I agree it's not the complete solution, but I think rails does a pretty good job at providing tools for making a progressive webapp. Many of us see the apps that have a blank page until data is loaded and the front end JS then renders. It's just a yuck experience. I dislike the fact that it happens in one of my own projects. While I find the concept of turbo links weird with pulling raw html over XHR and then renderi…

React's server-side rendering solves the blank page issue.

Re: Drop jQuery as a dependency from Rails

#93
post #87
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.

Ah, ok, so you're not a 10 year JavaScript developer, that's very different thing. If you were doing DOM manip 10 years ago without jQuery / MooTools / Dojo / YUI you would be someone that loves pain.

Yes.

I started with learning vanilla JS and doing my professional stuff with ExtJS.

But as you say, jQuery wasn't a requirement. I knew a few people who hated it with passion back then, they were all using MooTools. That's probably why I avoided it...

Re: Drop jQuery as a dependency from Rails

#94

Earlier quoted context omitted.

The new TurboLinks is one of the best things about Rails 5, though. You can basically get UX comparable to an SPA with mostly server code. As for coffeescript, you can just remove the gem and it'll use regular JS. https://www.nateberkopec.com/2015/05/27/100-ms-to-glass-with...

Sadly, you can't just remove the gem anymore. At least not if you want to use ActionCable. ActionCable generators only generate Coffeescript.

ActionCable generators can now generate either JS or Coffeescript. This is relatively recent, but the direction is clearly toward decoupling.

https://github.com/rails/rails/commit/63ac6255ba3553b529f4b2...

Re: Drop jQuery as a dependency from Rails

#95

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…

> why use Django at all?

I like Django to build "hybrid" apps where e.g. public sites, registration form, etc. are rendered by the backend using only a couple of lines of js (not even using jQuery or similar) to enhance user expirience and another part of the app being a fullblown SPA using Django as a REST api.

Re: Drop jQuery as a dependency from Rails

#96

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.

Cut fresh from actual potatoes right in front of you. Just sayin..

That's not actually a good thing when it comes to french fries.[1] To get a good crisp exterior and a fluffy interior, you need a multi-stage process -- blanch in hot water, fry, freeze, and then fry again. French fries cooked from frozen differ from fries cooked fresh because the freezing crystallizes the water inside, essentially tearing the inside of the fry apart and making it easier for the fry to release its moisture during cooking. Cooking from actual potatoes right in front of you means they don't have time to actually do any of the stuff necessary to make good french fries.

1) http://aht.seriouseats.com/archives/2010/05/the-burger-lab-h...

Re: Drop jQuery as a dependency from Rails

#97

Earlier quoted context omitted.

It is for "most web apps" because most web apps are like basecamp, and it isn't "use the latest or GTFO". It is "use the latest by default or add a single line to your gem file if you want to support older browsers." Most web apps are only tested on the latest browsers anyway, even if they claim to support older browsers. This is true unless you have a very popular app and a very large team.

> Most web apps are only tested on the latest browsers anyway I've worked in web/related fields for about 10 years now, and I've never worked on a project where "fuck it, the latest will do" has been acceptable.

Yeah, same here. This comment thread is bizarre. I've been writing web apps that serve an industry where users don't install their software but their IT department does on their behalf: hospitals, but schools and government agencies are very similar, as well. Many of these apps are required to support back to IE8. For better or worse, that is the world some of these apps must live in.

Re: Drop jQuery as a dependency from Rails

#98

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.

We detached this subthread from https://news.ycombinator.com/item?id=11814018 and marked it off-topic.

Re: Drop jQuery as a dependency from Rails

#99
post #27

Earlier quoted context omitted.

You're missing the central point of default rails stack. http://david.heinemeierhansson.com/2012/rails-is-omakase.htm...

Sure, except in this case the Rails defaults are totally at odds with how the larger JS ecosystem has evolved. CoffeeScript was basically the logical complement to Haml (Ruby-like syntax for HTML) and Sass (Ruby-like syntax for CSS) -- although Sass has since dropped its original syntax and moved on with the CSS-like SCSS. Since then CS has lost a lot of popularity outside the Rails community. Babel and TypeScript pr…

From experience, projects that use any of the available javascript frameworks also use jquery in some way or another. Including it is a tone saver. But coffee script should be removed as a default.

Re: Drop jQuery as a dependency from Rails

#100
post #8

Earlier quoted context omitted.

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

I started with Prototype. Not sure if it came out before or after the first jQuery, but it was the cool kid for a while. Then the world realized it was a disaster and started moving to jQuery...

Too bad Magento devs missed that newsflash. Nowadays it still bundles Prototype.js, and every theme and 50% third-party modules you install carry their own copies of jQuery, all at different versions, placed in random locations, and embedded into the page differently.
Post reply on HN