updated the regex to support nested files and refactored some unclear functions
This commit is contained in:
parent
753ad37df7
commit
fdd639efaf
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user