How to "repeat-x" a sprite, generated by Compass
I have a gradient
directory in my assets/images
in a Rails 3.1 application. Here's the code I use to create a sprite from those images using Compass:
$gradient-repeat: repeat-x;
@import "compass";
@import "gradient/*.png";
body > header > nav {
clear: both;
@include gradient-sprite(red-menu);
}
开发者_StackOverflowMy problem is that even though I explicitly tell Compass that I want my background to be repeated horizontally, it still produces the following CSS:
body > header > nav {
clear: both;
background-position: 0 -207px;
height: 34px;
}
.gradient-sprite, body > header > nav {
background: url(/assets/gradient-sbe06665f77.png) no-repeat;
}
and so my gradient does not get repeated horizontally.
I'm using the 3.1 branch of the Compass gem in my Gemfile.
Now, I could simply add a background-repeat: repeat-x;
to my code and override what Compass has generated for me, but that I feel is not the Rails way of doing things.
Any help would be greatly appreciated.
精彩评论