Question

I can't seem to figure out how to make sprockets find assets in vendor/assets. I've ben been pushing off the problem by adding all of my assets to app/assets, but it's becoming way too cluttered.

I have read the documentation, and tried adding all of the following lines to my application.rb file.

config.assets.paths << "#{Rails.root}/vendor/assets/*"
config.assets.paths << "#{Rails.root}/vendor/assets/fonts"
config.assets.paths << "#{Rails.root}/vendor/assets/stylesheets"
config.assets.precompile << Proc.new { |path|
  if path =~ /\.(eot|svg|ttf|woff)\z/
    true
  end

They work locally, but when I push them to the server, none of my vendor assets are there. I'm using capistrano for deployments, and I know that there were some issues with the upgrade. That could be the root of the problem, but I followed the documentation to get it deploying (almost) everything alright.

Was it helpful?

Solution

The problem turned out to be me being stupid, and quick to jump the gun on other problems. I dove too far down the rabbit hole, and lost sight of what was happening. I did not include the otf filetype in the regex, and it wasn't being included.

Facepalm

EDIT:

To clarify: all I had to do was change

if path =~ /\.(eot|svg|ttf|woff)\z/

to

if path =~ /\.(eot|svg|ttf|woff|otf)\z/

OTHER TIPS

When you run rake assets:precompile are you manually setting the env to production?

The command should read:

RAILS_ENV=production rake assets:precompile

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top