I was under the impression that Compass could generate sprites from image files in a Rails 3.1+ asset pipeline environment; however, I can't get it to work.
In my application.scss file I have the following code:
@import "foo/*.png";
@include all-foo-sprites;
If I have the foo
directory in app/assets/images
, this works just fine, but if I have it in lib/assets/images
or vender/assets/images
it doesn't work at all.
I keep getting the error:
No files were found in the load path matching "foo/*.png". Your current load paths are: /Users/xxxxxx/app/assets/images
But I know that vender/assets/images/foo
is in the load path because image-url('foo/bar.png')
works just fine.
What I'd really like is to have the images in a Gem (since they're shared across many of my apps), but I can't get that to work either.
Does anyone know if this is possible? I know compass-rails supports the asset pipeline, but I can't find anywhere that mentions support for this specific feature.
It looks like by default compass-rails doesn't look for sprites in the normal assets pipeline directories which isn't what I expected but it can be easily added if you want it.
I just added the following code in a compass initializer which basically adds all of the asset pipeline load paths to Compass's sprite_load_path.
Compass.add_configuration({:sprite_load_path => Compass.configuration.sprite_load_path + Rails.application.config.assets.paths}, 'sprites')