Compass/compass-rails — Issue #17: Unable to have more than 1 sprite_load_path
Author: exviva
Created: 2012-02-29 11:16:49+00:00
State: open

(This issue is somewhat related to #5)

We're having problems adding sprite_load_paths to Compass's configuration. It seems like only the first path is actually used.

What we're trying to achieve is something like Rails's view paths inheritance - try to find a sprite image in one directory, if it doesn't exist, try the next directory from the sprite load paths.

We're using Rails 3.1.3, compass-rails 1.0.0.rc.3 and compass 0.12.rc.1.

Here's a sample Rails application that reproduced the problem: https://github.com/exviva/compass_rails_sprite_load_path

The application has two directories with sprite images: `app/assets/images` and `app/assets/more-important-images`. Both contain a directory called `icons`.

Both `icons` directories contain two files - one unique to them and one with the shared name.

The sprites are imported and used in `app/assets/stylesheets/layout.css.scss`.

The important bit is in `config/initializers/compass.rb`: it's adding both directories to `sprite_load_path` (using a technique suggested in #5).

I've also tried several other methods, and they all fail in the same way: only the directory added as first is available to the sprite importer.

When I try to request `/assets/application.css`, I'm getting the following error: `No sprite called all_the_things found in sprite map icons/icons. Did you mean one of: y_u_no, yo_dawg`. If I reverse the order of appending to sprite load paths, I get a similar error saying that `yo_dawg` cannot be found.

Is there something we're doing wrong? Is there even a way to make it work? I'd gladly provide a patch if possible.