[Compass Core] Initial css-sprite implementation.

This commit is contained in:
tdreyno 2009-05-15 19:44:48 +01:00 committed by Chris Eppstein
parent 4533a00085
commit 1f21d63091
3 changed files with 14 additions and 0 deletions

View File

@ -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 File

@ -0,0 +1 @@
@import sprites/sprite_img.sass

View File

@ -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