Question

I have a problem, my images does not show up on heroku .. There are no error messages in the push and I installed the gem 'rails_12factor' in my gemfile ..

So I do not really know what to do

The adress is http://middiz.herokuapp.com/

Could you have a look guys and help me please ?

Thx so much

image desc

Was it helpful?

Solution

I can see some images, but for posterity & to give you an idea as to what the problem may be, I thought I'd better write this answer to help you run images on Heroku


Dynamic CSS

CSS-based images change when you pre-compile them & deploy to Heroku. Rails uses asset fingerprinting to link the dependent asset files to the asset itself. This means you have to ensure your css has dynamic image paths, rather than static ones, and the way to do this is to use SCSS

SCSS allows you to dynamically insert values into the asset pipeline, thus allowing you to serve images dynamically. Here's how it works:

#app/assets/application.css
background-image: url('background.png'); /* --> Renders static asset every time */

#app/assets/application.css.scss
background-image: image_path('background.png'); /* --> dynamically renders the fingerprinted path */

I appreciate it's not a direct fix for you, but I hope it shows a way to fix the problem

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