Search code examples
sassconfigspritecompass

Compass sprite path causing error


I've tried many responses already, but for some reason I can't get this to work. The error is:

No files were found in the load path matching "sprites/*.png"

My config.rb code:

relative_assets = true
cache=false

Encoding.default_external = "utf-8"

#########
# 1. Set this to the root of your project when deployed:
http_path = "/"
http_generated_images_path = "../images";

# 2. probably don't need to touch these
css_dir = "../css"
sass_dir = "./"
images_dir = "../images"
images_path = "../images"
javascripts_dir = "../js"
environment = :development

line_comments = true

My folder structure:

css

images
- sprites

scss (config.rb located in scss folder)
- partials
- - _mixins.scss (the file where the error is occuring)

And in mixins:

@import "sprites/*.png"; 

Any ideas what's wrong with the paths?

Thanks for any help.


Solution

  • First question is: do you actually have any files in your sprites folder? If yes, try adding this setting:

    generated_images_path = "../images"
    

    http_generated_images_path will be used to define what is the final path for the generated image, in the final (compiled) css, so maybe the setting above (without http_) is the one you need. My project structure is different but it works fine for me, I have more settings pointing to the same path though, this is what I have:

    images_dir = "/assets/img"
    generated_images_path = "assets/img"
    http_images_dir = "assets/img"
    http_images_path = "assets/img"
    

    If just the first one doesn't solve the problem for you, try maybe adding all these? Worst case change your project structure so you don't have to go up one level to get the folder (not saying that this is the problem as it shouldn't be but well, testing is the best way to find out)