From fdd639efafcdaf055c22f6ed169805a93c16cf94 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Wed, 11 May 2011 02:41:51 -0400 Subject: [PATCH] updated the regex to support nested files and refactored some unclear functions --- lib/compass/sass_extensions/sprites/sprite_map.rb | 2 +- lib/compass/sass_extensions/sprites/sprites.rb | 4 ++-- test/integrations/sprites_test.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compass/sass_extensions/sprites/sprite_map.rb b/lib/compass/sass_extensions/sprites/sprite_map.rb index 10f860e1..121c4e12 100644 --- a/lib/compass/sass_extensions/sprites/sprite_map.rb +++ b/lib/compass/sass_extensions/sprites/sprite_map.rb @@ -25,7 +25,7 @@ module Compass # Returns the Glob of image files for this sprite def files - @files ||= Dir[File.join(Compass.configuration.images_path, uri).gsub('/*', '/**/*')].sort + @files ||= Dir[File.join(Compass.configuration.images_path, uri)].sort end # Returns an Array of image names without the file extension diff --git a/lib/compass/sass_extensions/sprites/sprites.rb b/lib/compass/sass_extensions/sprites/sprites.rb index 7696d3bd..7431983f 100644 --- a/lib/compass/sass_extensions/sprites/sprites.rb +++ b/lib/compass/sass_extensions/sprites/sprites.rb @@ -3,8 +3,8 @@ module Compass attr_accessor :name, :path def self.path_and_name(uri) - if uri =~ %r{((.+/)?(.+))/(.+?)\.png} - [$1, $3, $4] + if uri =~ %r{((.+/)?([^\*.]+))/(.+?)\.png} + [$1, $3] end end diff --git a/test/integrations/sprites_test.rb b/test/integrations/sprites_test.rb index ea077625..23a45996 100644 --- a/test/integrations/sprites_test.rb +++ b/test/integrations/sprites_test.rb @@ -590,7 +590,7 @@ class SpritesTest < Test::Unit::TestCase it "should generate a sprite from nested folders" do css = render <<-SCSS - @import "nested/*.png"; + @import "nested/**/*.png"; @include all-nested-sprites; SCSS assert_correct css, <<-CSS