updated the regex to support nested files and refactored some unclear functions

This commit is contained in:
Scott Davis 2011-05-11 02:41:51 -04:00
parent 753ad37df7
commit fdd639efaf
3 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ module Compass
# Returns the Glob of image files for this sprite # Returns the Glob of image files for this sprite
def files def files
@files ||= Dir[File.join(Compass.configuration.images_path, uri).gsub('/*', '/**/*')].sort @files ||= Dir[File.join(Compass.configuration.images_path, uri)].sort
end end
# Returns an Array of image names without the file extension # Returns an Array of image names without the file extension

View File

@ -3,8 +3,8 @@ module Compass
attr_accessor :name, :path attr_accessor :name, :path
def self.path_and_name(uri) def self.path_and_name(uri)
if uri =~ %r{((.+/)?(.+))/(.+?)\.png} if uri =~ %r{((.+/)?([^\*.]+))/(.+?)\.png}
[$1, $3, $4] [$1, $3]
end end
end end

View File

@ -590,7 +590,7 @@ class SpritesTest < Test::Unit::TestCase
it "should generate a sprite from nested folders" do it "should generate a sprite from nested folders" do
css = render <<-SCSS css = render <<-SCSS
@import "nested/*.png"; @import "nested/**/*.png";
@include all-nested-sprites; @include all-nested-sprites;
SCSS SCSS
assert_correct css, <<-CSS assert_correct css, <<-CSS