Why am I getting the wrong way with the compass

With a compass, when I try to create a sprite, the path to the main image of the sprite in screen.css goes wrong, because of which I cannot see the image.

My scss code

@import "compass"; @import "spr/*.png"; h1 { @include spr-sprite("car"); height:50px; width:50px; } 

My css output for sprite

 .spr-sprite, h1 { background: url('/images/spr-sa37328aec0.png') no-repeat; } h1 { background-position: 0 -147px; height: 50px; width: 50px; overflow: hidden; text-align: left; } 

You can see that from the background you should start with ../ , but not directly with /images/ . This creates a problem. My folder paths for images

 images ------spr ---*.png sass -----screen.scss css ---screen.css 

My config.rb codes

 # Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" 

I'm new to Sasuke and Compass, so maybe I missed some code. Please help me sort it out. Any help would be appreciated. Thank you very much. Thanks for the help.

+7
source share
1 answer

Add this to your config.rb :

 relative_assets = true 

(I assume that you are not using this from the root of the domain, otherwise it is not necessary. You are browsing through file:// ?)

+11
source

All Articles