From aaffea49afcd630b432dbff68e2945eaf80c8774 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 12 Sep 2010 17:30:08 -0700 Subject: [PATCH] factor out the saving from the generating, we'll need to monkey patch this in a rails environment. --- lib/compass/sprites.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/compass/sprites.rb b/lib/compass/sprites.rb index 5868feee..571530ce 100644 --- a/lib/compass/sprites.rb +++ b/lib/compass/sprites.rb @@ -35,7 +35,8 @@ module Compass::Sprites sprites.each do |sprite_name, sprite| calculate_sprite sprite 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 end end @@ -99,6 +100,10 @@ module Compass::Sprites y = sprite_item[:y].value sprite_image.replace sprite_item_image, x, y end + sprite_image + end + + def save_sprite_image!(sprite_image, sprite) sprite_image.save File.join(Compass::Sprites.images_path, sprite[:file]) end