Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
       - ...
like image 900
seferov Avatar asked Jun 07 '12 07:06

seferov


1 Answers

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/

like image 59
Alessandro Vendruscolo Avatar answered Oct 22 '22 01:10

Alessandro Vendruscolo