factor out the saving from the generating, we'll need to monkey patch this in a rails environment.

This commit is contained in:
Chris Eppstein 2010-09-12 17:30:08 -07:00
parent 0a447625e0
commit aaffea49af

View File

@ -35,7 +35,8 @@ module Compass::Sprites
sprites.each do |sprite_name, sprite| sprites.each do |sprite_name, sprite|
calculate_sprite sprite calculate_sprite sprite
if sprite_changed?(sprite_name, sprite, options) if sprite_changed?(sprite_name, sprite, options)
generate_sprite_image sprite sprite_image = generate_sprite_image sprite
save_sprite_image! sprite_image, sprite
remember_sprite_info! sprite_name, sprite, options remember_sprite_info! sprite_name, sprite, options
end end
end end
@ -99,6 +100,10 @@ module Compass::Sprites
y = sprite_item[:y].value y = sprite_item[:y].value
sprite_image.replace sprite_item_image, x, y sprite_image.replace sprite_item_image, x, y
end end
sprite_image
end
def save_sprite_image!(sprite_image, sprite)
sprite_image.save File.join(Compass::Sprites.images_path, sprite[:file]) sprite_image.save File.join(Compass::Sprites.images_path, sprite[:file])
end end