seferov
seferov

Reputation: 4161

Compass spriting

In order to achieve spriting by compass according to the documentation I wrote this:

// web/sass/icons.scss
@import "../images/icons/*.jpg"; // for any cases also tried .png 
@include all-icons-sprites;

and got the error:

error sass/icons.scss (Line 2: File to import not found or unreadable: ../images/icons/*.jpg.

I don't think the path is wrong because also tried full path.

The structure is like this:

+ web
  - sass
     + icons.scss
     + ...
  - images
     + icons
       - icon1.jpg
       - icon2.jpg
       - ...

Upvotes: 5

Views: 2394

Answers (2)

paul.g
paul.g

Reputation: 181

this thread is quiet old but cool solution for spiriting with compass is here on github

Upvotes: 0

Alessandro Vendruscolo
Alessandro Vendruscolo

Reputation: 14875

Compass for sprites uses the paths defined in config.rb.

So if you have this structure:

+ web
  + sass
    - icons.scss
  + images
    + icons
      - icon1.png
  + config.rb

In your config.rb you should have something similar to this:

...
images_dir = "images"
sass_dir = "sass"
...

Then in your icons.scss you should do this:

// web/sass/icons.scss
@import "icons/*.png"; // for any cases also tried .png 
@include all-icons-sprites;

Because the import is relative to the images directory we defined above.

Be sure to understand the configuration file, because it may be tricky http://compass-style.org/help/tutorials/configuration-reference/

Upvotes: 7

Related Questions