How to handle UJS when using Rails-assets.org Jquery (or exclude dependencies in a Rails-assets gem)

114 views Asked by At

I've recently started using Rails-assets.org and noticed that, if a particular asset has jQuery as a dependancy, it installs a version from Bower when bundling. This duplicates the jQuery package in a Rails app (given the use of the default 'jquery-rails' gem).

I'd be happy to keep only either version of jQuery but I've found two problems when trying to do so.

  1. If I exclude 'jquery-rails' gem form my app I won't be able to run 'jquery_ujs' which is packed together with the 'jquery-rails'. I haven't find a way to keep only 'jquery_ujs'. Is that possible?

  2. It'd probably be better to exclude the jQuery dependancy when installing a gem from rails-assets.org so I could keep using the default jQuery gem in Rails. I've googled this without success. Is this possible?

I was also wondering if it would be a problem if I leave both jQuery packages installed. Which one of those will be chosen by rails asset pipeline? I've tried and I haven't got any errors, but it doesn't sound like the best idea.

It'd be great if you can point me towards the right direction or advice on best practice. Thanks

0

There are 0 answers