In my Rails 3.2.1 application I am using compass(0.12.alpha.4) to create sprites:
@import compass
@import "../images/category-icons/type/*.png"
@include all-type-sprites
//+all-type-sprites
The sprite image was genereated correctly, sitting in app/assets/images/category-icons/type-sa69c4767de.png
However the stylesheet generated is wrong. It points to /assets/../images/category-icons/type-sa69c4767de.png. It merely appends assets to the path. It works outside of Rails, so I think it has something to do with asset pipeline. What should I configure for this to work properly?
Are you using
compass-rails? It ensures proper integration with the asset pipeline.Don’t use a relative path to the source images. Image path references already search through the asset load path. Rails is configured to include
app/assets/imagesin the asset load path by default.Change the import to:
@import "category-icons/type/*.png"