5

I am using Compass to create sprites. The sprites are being created but the css output is pointing to the wrong place for the images directory.

the output is:

.menu-sprite, .menu-about, .menu-art, .menu-drum, .menu-links, 
.menu-music, .menu-science, .menu-writing {
    background: url('/images/menu-sb7e36b009c.png') no-repeat;
}

but i want it to be:

.menu-sprite, .menu-about, .menu-art, .menu-drum, .menu-links, 
.menu-music, .menu-science, .menu-writing {
    background: url('images/menu-sb7e36b009c.png') no-repeat;
}

here is my confib.rb setup:

http_path = "/"
css_dir = "."
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"

and here is how im calling the sprites in my scss file:

@import "compass/utilities/sprites/base";
@import "menu/*.png";
@include all-menu-sprites;

what am i doing wrong? How can i remove that first slash in front of images?

thanks for any help.

1
  • 3
    I found the answer. just needed to add relative_assets = true to the confib.rb
    – abelb
    May 26, 2012 at 20:40

1 Answer 1

6

By default, compass uses absolute paths for all assets.

To change this behaviour, add this line to your config.rb:

relative_assets = true

Otherwise, you could also change the 'http_path' option to point to where your project sites on your deployment server.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.