I am using Rails 3.2 and the jquery-ui-rails plugin to add the datepicker to my JS manifest file.
This is my manifest file:
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require_tree .
I am getting my jQuery library separately from Google’s CDN.
However, by adding jquery.ui to the manifest file, it automatically includes its jQuery dependency – so now I end up with two jQueries on my final HTML document.
I don’t want this additional jQuery file – I only want the one from Google’s CDN. Using sprockets, I can use the stub directive to selectively ‘exclude’ the jQuery file.
So this what I did – and it doesn’t work – ie jQuery is still added to my final JS file …
//= stub jquery
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require_tree .
I have tried several combinations:
//= stub jquery.js
//= stub "jquery"
//= stub "jquery.js"
//= stub "/jquery.js"
etc …
But none of these work. I haven’t been able to find an example anywhere of how this is supposed to work. Incidentally, I have also tried
//= stub jquery_ujs
Which didn’t stub out the jquery_ujs library either …
I think the reason why it doesn’t work is that Rails 3.2.x only uses sprockets v2.1. Stubs, however, are only available in sprockets >= 2.2. You could try manually updating sprockets (forking actionpack).