Reputation: 1453
Sprockets-rails, which has been moved out of rails and is now its own gem, no longer auto complies assets from gems in the gems respective vendor and lib folders. Meaning you have to add every file from gems vendor and lib folders to either application.js, application.css, or for images/fonts add them each to config.assets.precompile.
https://github.com/rails/rails/pull/7968
How do I restore the default behavior and have it act like it did in rails three?
Upvotes: 1
Views: 881
Reputation: 4654
This works for me in application.rb
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
Upvotes: 1
Reputation: 1453
In your environments file put the following to restore the old default behavior.
config.assets.precompile += [Proc.new { |path| !%w(.js .css).include?(File.extname(path)) }]
This is lifted directly from the old code.
As of the date of posting this in the current version of sprockets-rails setting config.assets anything is broken, the gem is trying to get the environment before its loaded. But this will work if you patch it yourself or use one of the patched version out there of both sprockets and sprockets-rails.
sprockets-rails https://github.com/rails/sprockets-rails/pull/36
sprockets https://github.com/sstephenson/sprockets/pull/404
Upvotes: 0