Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Compass Core] Initial css-sprite implementation.

  • Loading branch information...
commit 1f21d6309140c009188d350ed911eed5d34bf02e 1 parent 4533a00
@tdreyno tdreyno authored chriseppstein committed
View
1  frameworks/compass/stylesheets/compass/_utilities.sass
@@ -1,5 +1,6 @@
@import utilities/general.sass
@import utilities/links.sass
@import utilities/lists.sass
+@import utilities/sprites.sass
@import utilities/tables.sass
@import utilities/text.sass
View
1  frameworks/compass/stylesheets/compass/utilities/_sprites.sass
@@ -0,0 +1 @@
+@import sprites/sprite_img.sass
View
12 frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass
@@ -0,0 +1,12 @@
+!sprite_image_default_width ||= 32px
+!sprite_image_default_height ||= 32px
+!sprite_image_default_margin ||= 0px
+
+// Simplest use: +sprite-img("icons-32.png", 1)
+=sprite-img(!img, !col, !row = 1, !width = !sprite_image_default_width, !height = !sprite_image_default_height, !margin = !sprite_image_default_margin)
+ !x = ((!col - 1) * -!height) - ((!col - 1) * !margin)
+ !y = ((!row - 1) * -!width) - ((!row - 1) * !margin)
+ :background= image_url(!img) "no-repeat" !x !y
+ :width= !width
+ :height= !height
+ :overflow hidden

0 comments on commit 1f21d63

Please sign in to comment.
Something went wrong with that request. Please try again.