sstephenson / sprockets

Rack-based asset packaging system
2.55k stars 24 forks source link

Sprockets 3.0.1, Breaks rails-assets.org #720

Closed nitsujri closed 8 years ago

nitsujri commented 9 years ago

I upgraded sprockets from 2.12.3 to 3.0.1 and a number of js files from rails-assets.org no longer loads (but some do?).

Gemfile

gem 'rails-assets-uri.js', source: 'https://rails-assets.org'

application.js

//= require uri.js

Error:

 Showing ../app/views/layouts/application.html.slim where line #11 raised:

 couldn't find file 'uri.js' with type 'application/javascript'

 //= require uri.js

I can change my Gemfile.lock from sprockets (3.0.1) to sprockets (2.12.3) and it will work just fine again, or I can add the line gem 'sprockets', "~> 2.12.3" to my Gemfile

Thanks for everything that you guys do! I'll be glad to test anyway I can.

allaire commented 9 years ago

Same, see https://github.com/rails-assets/rails-assets/issues/252

funwhilelost commented 9 years ago

As a good example of this you can use "intro.js" from rails-assets. When you include this directive in application.js: //= require intro it will descend into the various directories looking for JavaScript files to include. Unfortunately it looks like it's too greedy and is grabbing files all the files, including CSS.

--- JavaScript, as expected ---
  }
  else {
    // Export for a browser or Rhino.
    root._ = _;
  }
}.call(this));
/* line 1, /Users/infamouse/.rvm/gems/ruby-2.1.5@test-project/gems/rails-assets-intro.js-1.0.0/app/assets/stylesheets/intro.js/introjs.scss */
.introjs-overlay {
  position: absolute;
--- CSS directives! ---

When you use the gems they append their directories to the Rails.application.config.assets.paths like so:

"/Users/infamouse/.rvm/gems/ruby-2.1.3@test-project/gems/rails-assets-intro.js-1.0.0/app/assets/images",
 "/Users/infamouse/.rvm/gems/ruby-2.1.3@test-project/gems/rails-assets-intro.js-1.0.0/app/assets/javascripts",
 "/Users/infamouse/.rvm/gems/ruby-2.1.3@test-project/gems/rails-assets-intro.js-1.0.0/app/assets/stylesheets",
 "/Users/infamouse/.rvm/gems/ruby-2.1.3@test-project/gems/rails-assets-intro.js-1.0.0/app/assets/templates",

It appears that this but only affects projects that have a directory inside the gem that ends with .js such as intro.js which has a directory called app/assets/stylesheets/intro.js/. Every file inside of this directory is included in the sprockets precompiled JavaScript.

schneems commented 9 years ago

If this is still an active issue can you close this one and re-open it at http://github.com/rails/sprockets. Active development has moved to that repo.

If you've got a bug with sprockets 3 please make sure you've tried the latest 3.3.3. If you can confirm this is still an active issue, the fastest way to get it fixed is to create a small example app that reproduces the failure and open an issue in the new repo http://github.com/rails/sprockets.

rafaelfranca commented 8 years ago

This issue was moved to rails/sprockets#180