jhodgson4
jhodgson4

Reputation: 1656

Compass adding leading slash when generating sprite

I have just generated a sprite with compass, but for some reason it is adding a leading slash in the generated class url. Is it possible to override this or is it something I have wrong in my config.rb?

Thanks for any help.

Joe

config.rb >

http_path = "/"
css_dir = "/"
sass_dir = "/"
images_dir = "img"
javascripts_dir = "js"

sass >

@import "spr/*.png";
@include all-spr-sprites;

generated css >

.spr-sprite, .spr-female, .spr-male {
  background: url('/img/spr-s88dfc99cac.png') no-repeat;
}

Upvotes: 0

Views: 518

Answers (1)

jhodgson4
jhodgson4

Reputation: 1656

Appologies, as soon as I posted the question I found the answer to another question here ...

Compass throwing in forward slash in front of images when making sprites

ANSWER:

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.

Upvotes: 1

Related Questions