Chad
Chad

Reputation: 18396

Compass Can't Find Sprite Folder

For some reason Compass can not find this folder I setup for sprites. This is what my directories look like.

Project
   media
      compass
         sass
            modules
               _module.scss
            style.scss
         config.rb
      images
         sprites
             button_hover.jpg
             button_active.jpg
             button.jpg

And inside of my config.rb file I have the images_dir setup to be ../images. The errors I get when I try import ( @import '../images/sprites/button*.jpg') the files inside of the _module.scss are mainly this:

File to import not found or unreadable: images/sprites/button*.jpg.

Not sure what is going on.

Upvotes: 3

Views: 1496

Answers (4)

Thomas Venturini
Thomas Venturini

Reputation: 3750

configure your config.rb. then compass will know where to find your images ;)

and compass seems to work with png's only.

Upvotes: 0

ippi
ippi

Reputation: 10167

I had this problem with compass 0.12.2 in windows using png files and solved it by editing C:\Ruby193\lib\ruby\gems\1.9.1\gems\compass-0.12.2\lib\compass\sprite_importer.rb

Change line 19:

-      Dir.glob(File.join(path, "**", glob))
+      Sass::Util.glob(File.join(path, "**", glob))

And line 78:

-        files = Dir[File.join(folder, uri)].sort
+        files = Sass::Util.glob(File.join(folder, uri)).sort

All according to this source: https://github.com/chriseppstein/compass/commit/58babac01b56eddf63bac737f7f781d98f00f6b9

Upvotes: 1

Josef Richter
Josef Richter

Reputation: 181

Compass sprites are PNG only. No JPG afaik.

Upvotes: 11

Maxime Fabre
Maxime Fabre

Reputation: 2252

Well if styles.scss is in media/compass/sass and images is in media/ then you need to do ../../ instead of ../ no ?

Upvotes: 2

Related Questions