added the ability to disable magic sprites
This commit is contained in:
parent
3e013b8bd5
commit
6b884d34c3
@ -7,7 +7,7 @@ GIT
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
compass (0.11.beta.7.5b9a90f)
|
compass (0.11.beta.7.3e013b8)
|
||||||
chunky_png (~> 1.1.0)
|
chunky_png (~> 1.1.0)
|
||||||
sass (>= 3.1.0.alpha.249)
|
sass (>= 3.1.0.alpha.249)
|
||||||
|
|
||||||
|
@ -20,13 +20,18 @@ $sprite-selectors: hover, target, active !default;
|
|||||||
// class or you can specify the `sprite-url` explicitly like this:
|
// class or you can specify the `sprite-url` explicitly like this:
|
||||||
//
|
//
|
||||||
// background: $map no-repeat;
|
// background: $map no-repeat;
|
||||||
|
|
||||||
|
$disable-magic-sprite-selectors:false !default;
|
||||||
|
|
||||||
@mixin sprite($map, $sprite, $dimensions: false, $offset-x: 0, $offset-y: 0) {
|
@mixin sprite($map, $sprite, $dimensions: false, $offset-x: 0, $offset-y: 0) {
|
||||||
@include sprite-background-position($map, $sprite, $offset-x, $offset-y);
|
@include sprite-background-position($map, $sprite, $offset-x, $offset-y);
|
||||||
@if $dimensions {
|
@if $dimensions {
|
||||||
@include sprite-dimensions($map, $sprite);
|
@include sprite-dimensions($map, $sprite);
|
||||||
}
|
}
|
||||||
|
@if not $disable-magic-sprite-selectors {
|
||||||
@include sprite-selectors($map, $sprite, $sprite);
|
@include sprite-selectors($map, $sprite, $sprite);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Include the selectors for the `$sprite` given the `$map` and the
|
// Include the selectors for the `$sprite` given the `$map` and the
|
||||||
// `$full-sprite-name`
|
// `$full-sprite-name`
|
||||||
|
@ -517,6 +517,25 @@ describe Compass::Sprites do
|
|||||||
CSS
|
CSS
|
||||||
end
|
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
|
it "should raise error on filenames that are not valid sass syntax" do
|
||||||
lambda do
|
lambda do
|
||||||
render <<-SCSS
|
render <<-SCSS
|
||||||
|
Loading…
Reference in New Issue
Block a user