Tim
Tim

Reputation: 6219

Sprockets::FileNotFound when trying to include a jQuery gem

I'm trying to use https://github.com/linjunpop/jquery-tablesorter-rails to sort my tables. I'm running into issues when trying to include the CSS:

 /*
 * = require jquery-tablesorter/blue
 */

Error message:

Sprockets::FileNotFound: couldn't find file 'jquery-tablesorter/blue'

I do see the Gem being loaded in the config path:

1.9.3p194 :008 > Rails.application.config.assets.paths.each { |x| puts x }
.rvm/gems/ruby-1.9.3-p194/gems/jquery-tablesorter-1.0.5/vendor/assets/images
.rvm/gems/ruby-1.9.3-p194/gems/jquery-tablesorter-1.0.5/vendor/assets/javascripts
.rvm/gems/ruby-1.9.3-p194/gems/jquery-tablesorter-1.0.5/vendor/assets/stylesheets

Any idea what the issue could be?

Upvotes: 3

Views: 2108

Answers (4)

Nithaele
Nithaele

Reputation: 31

The corret path is:

*= require jquery-tablesorter/theme.blue

Upvotes: 3

pjmorse
pjmorse

Reputation: 9294

I'm seeing the path you're requiring as a directory; the error message seems to indicate that it's failing to find a file. Have you tried

*= require jquery-tablesorter/blue/*

instead?

Upvotes: 0

Mottie
Mottie

Reputation: 86453

I've updated Tablesorter to use themes in version 2.4+, so the blue theme file has been renamed and moved to a different directory.

I don't know much about Ruby, or that repo but you might want to get Tablesorter v2.3.11 until that repo has been updated (see this issue in that repo).

Upvotes: 0

rewritten
rewritten

Reputation: 16435

Can't reproduce. Usually when this kind of things happen to me is because of forgetting to restart the dev server after bundling a new gem. Sprockets tries to build or resolve a new set of assets, but the loaded environment is the same as before, so the additional asset can't be found.

Upvotes: 3

Related Questions