Dave Collins
Dave Collins

Reputation: 1087

Rails 5 Capistrano Deploy only sending shallow assets images

Using Rails 5.1.4 and capistrano-rails 1.3 (yarn and webpacker) to deploy to Ubuntu server.

All is working well except that "deep" folders of app/assets/images are not being precompiled and/or sent to the server.

All images at the root level of app/assets/images are getting precompiled and sent to /appname/current/public/assets. However, I also have an app/assets/images/content sub-folder. That sub-folder does not get sent to the server.

I've checked to be sure it isn't just a symlink issue, but it appears not: Even the source directory /home/deploy/appname/releases/20180106013806/public/assets is missing the /content folder.

I've made sure that Rails should be including "deep" images with the following in config/initializers/assets.rb:

Dir.glob("#{Rails.root}/app/assets/images/**/").each do |path|
  Rails.application.config.assets.paths << path
end

At this point not really sure if this is Rails failing to precompile the "deep" folder, or it not getting sent during the Capistrano deploy process.

Upvotes: 0

Views: 57

Answers (1)

Dave Collins
Dave Collins

Reputation: 1087

Well... This is one of those problems that becomes obvious when you step away from it!

Had /app/assets/images/content in my .gitignore file which means Capistrano dutifully ignored it! Removed that from .gitignore and Capistrano deployed it as expected.

Upvotes: 0

Related Questions