Search code examples
rubyamazon-s3ruby-on-rails-4amazon-cloudfront

Digest doesn't seem to work with SVG-images inside a Sass file


I have upgraded a rails app to version 4, but have some issues with Sass on Heroku. It seems like none of my included image in the Sass file gets the digest appended to the file.

Since rails 4 only generates a digest version of the assets, this fails. What can I do so the images in the Sass file on Heroku, also appends the digest to the CSS?


Solution

  • When referencing images within a sass file that are served up by the asset pipeline, you need to use the helpers provided by the sass-rails gem. From the Rails site:

    image-url("rails.png") becomes url(/assets/rails.png)
    image-path("rails.png") becomes "/assets/rails.png"