rails/jquery-rails

Move jquery-ui.js into jquery-ui-rails gem

joliss opened this issue · 15 comments

Hey guys,

I just packaged up jQuery UI for the asset pipeline: http://www.solitr.com/blog/2012/02/jquery-ui-rails-gem-for-the-asset-pipeline/

I was wondering what you thought about moving the jquery-ui.js that's currently shipping with jquery-rails into the jquery-ui-rails gem?

Right now we can't add a "jquery-ui.js" asset to jquery-ui-rails, because it would conflict with jquery-rails's version. (Which of the two gets picked up by Sprockets would be undefined, so that's asking for trouble.) So here's my suggestion:

  • In jquery-rails:
    1. Make one last 2.x release with jquery-ui.js 1.8.17
    2. Remove jquery-ui.js and jquery-ui.min.js from jquery-rails
    3. Bump the major version to 3.0.0-beta1 and release
    4. Put a note in the README that people might need to add the jquery-ui-rails gem with the 3.0.0 beta release if they want to use jquery-ui[1]
  • In jquery-ui-rails:
    1. Add jquery-ui.js (essentially the same as the one that ships with jquery-rails)
    2. Depend on jquery-rails >= 3.0.0-beta1 to avoid conflicts
    3. Bump the version to 1.0.0-beta1 and release

What do you think?

[1] I was thinking whether jquery-rails should depend on jquery-ui-rails so people get jquery-ui automatically. But since jquery-ui-rails adds a bunch of files (like "jquery.ui.datepicker.js") into the asset space that might conceivably conflict with user-supplied jQuery UI assets, I think it's best not to force it onto people, and instead require them to add jquery-ui-rails to their Gemfile if they want it.

Hey @joliss, I definitely like the idea of having jquery-ui in a separate gem, as it's a pain for us to maintain considering none of us really use it. A couple questions/comments:

  • I don't really want to bump jquery-rails a major version just to remove the packaged jquery-ui. I'd rather just remove jquery-ui when we're about to bump the next version anyway.
  • Given the last point, I'm unclear on what the conflict is. The jquery-ui gem has jQueryUI namespaced as jquery.ui.all, compared with jquery-rails being jquery-ui.
  • I agree with your last thought. I don't think there's any need to make jquery-rails depend upon jquery-ui-rails since the majority of people don't use it. And it's as easy as adding it to your Gemfile if people do want to use it.

I'd rather just remove jquery-ui when we're about to bump the next version anyway.

Right, that seems perfectly reasonable.

Given the last point, I'm unclear on what the conflict is. The jquery-ui gem has jQueryUI namespaced as jquery.ui.all, compared with jquery-rails being jquery-ui.

Ah, so the reason why I'm hoping to eventually include a jquery-ui.js file in jquery-ui-rails is that it's part of the official jQuery UI distribution, whereas jquery.ui.all.js actually isn't. I don't think this is an urgent issue though. As you said, let's remove it from jquery-rails next time you guys bump the major version.

Cool, sounds like a plan. I'm going to keep this issue open for now as a reminder.

hey guys, if you guys plan to move jquery.ui to a separate gem, could you please make a rails-jquery.mobile gem as well? Or if you know such one already exists?

Thanks for the awesome work of keep rails-jquery

That's not trivial, since you would have to somehow extract the dependencies between jQuery Mobile modules and turn them into Sprockets (Rails asset pipeline) dependencies. They don't use the same system as jQuery UI, so you'd need new code for that.

+1 to extracting

+1 too

Something like adding in jquery-ui-mobile would have to do some detection work to determine if mobile lineage is needed (screen sizes anyone?)

bai commented

Considering the upcoming update to jQuery 1.9, I would like to bump this one. Looks like jQuery UI has been gemified separately a while ago already. What do you think?

👍

Since JQuery UI isn't being kept up to date in this gem, I like the idea of removing it in favour of jquery-ui-rails. Since it is a removal, I think this change would be best suited for jquery-rails 3.0, which also takes us to JQuery 2.0 and removes support for old IE. (semantic versioning and all that)

I think the fact that jquery-rails includes a file called jquery-ui.js creates the opportunity for a third-party gem to //= require jquery-ui and thus clobber the jquery-ui-rails version.

If that's right, it would be good to pull jquery-ui.js from jquery-rails, or at least rename the file to minimize the chances of accidental clobbering.

I'm on board for this. It's been the eventual plan for a while. @indirect you agree? Think I'll go ahead and yank jquery-ui from jquery-rails and bump to v2.3.

It's pretty silly that sprockets is so collisionful. :P

​We should bump to 3.0, since we're removing something, but yeah, let's do it and point people at the UI gem.

On Wed, May 29, 2013 at 10:13 AM, Steve Schwartz notifications@github.com
wrote:

I'm on board for this. It's been the eventual plan for a while. @indirect you agree? Think I'll go ahead and yank jquery-ui from jquery-rails and bump to v2.3.

Reply to this email directly or view it on GitHub:
#46 (comment)

I went ahead and created versions 2.2.2 (latest jquery-ujs), and 2.3.0 (jquery 1.10.0 and jquery-ui 1.10.3) for those that want them.

And now, v3.0.0 is released as well with jquery-ui removed.