Struggling with getting my background images to show up after deploying my Rails app on Heroku has been quite a challenge. After diving into the Heroku documentation, I discovered this helpful tip:
In Rails 4 sprockets only generate digest filenames, which requires using an ERB helper like so to reference your assets:
<%= asset_path('logo.png') %>
Remember to add a .erb extension to any files in app/assets that utilize an ERB helper. For instance, application.css should be renamed to application.css.erb.
I attempted renaming the style.css.scss
file containing the problematic background images to style.css.scss.erb
. This change allowed me to modify the link to the troublesome background images to:
background: <%= asset_path('bg-hero-000.jpg') %> no-repeat center center fixed;
Nevertheless, I am uncertain if this adjustment will solve the issue of displaying my images on Heroku as a
File to import not found or unreadable:
error is now appearing for that file.
Despite extensively researching this problem online, I have yet to find a solution. Any assistance or insights would be greatly appreciated!