added the ability to disable magic sprites

This commit is contained in:
Scott Davis 2011-04-19 20:31:29 -04:00
parent 3e013b8bd5
commit 6b884d34c3
3 changed files with 26 additions and 2 deletions

View File

@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
compass (0.11.beta.7.5b9a90f)
compass (0.11.beta.7.3e013b8)
chunky_png (~> 1.1.0)
sass (>= 3.1.0.alpha.249)

View File

@ -20,12 +20,17 @@ $sprite-selectors: hover, target, active !default;
// class or you can specify the `sprite-url` explicitly like this:
//
// background: $map no-repeat;
$disable-magic-sprite-selectors:false !default;
@mixin sprite($map, $sprite, $dimensions: false, $offset-x: 0, $offset-y: 0) {
@include sprite-background-position($map, $sprite, $offset-x, $offset-y);
@if $dimensions {
@include sprite-dimensions($map, $sprite);
}
@include sprite-selectors($map, $sprite, $sprite);
@if not $disable-magic-sprite-selectors {
@include sprite-selectors($map, $sprite, $sprite);
}
}
// Include the selectors for the `$sprite` given the `$map` and the

View File

@ -517,6 +517,25 @@ describe Compass::Sprites do
CSS
end
it "should not render corret sprite with css selectors via magic mixin" do
css = render <<-SCSS
@import "selectors/*.png";
a {
$disable-magic-sprite-selectors:true;
@include selectors-sprite(ten-by-ten)
}
SCSS
css.should == <<-CSS
.selectors-sprite, a {
background: url('/selectors-edfef809e2.png') no-repeat;
}
a {
background-position: 0 0;
}
CSS
end
it "should raise error on filenames that are not valid sass syntax" do
lambda do
render <<-SCSS