File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,25 @@ def find_asset!(*args)
129
129
end
130
130
end
131
131
132
+ # Find all asset by a regexp filemask or a filepath.
133
+ def find_all_assets ( *args , &block )
134
+ paths = config [ :paths ]
135
+
136
+ args . each do |arg |
137
+ if arg . is_a? ( Regexp )
138
+ paths . each do |path |
139
+ files = Dir [ "#{ path } /*" ] . select { |file | arg =~ file }
140
+
141
+ files . each do |file |
142
+ find_all_linked_assets ( file , &block )
143
+ end
144
+ end
145
+ else
146
+ find_all_linked_assets ( *args , &block )
147
+ end
148
+ end
149
+ end
150
+
132
151
# Pretty inspect
133
152
def inspect
134
153
"#<#{ self . class } :0x#{ object_id . to_s ( 16 ) } " +
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ def find(*args)
122
122
environment = self . environment . cached
123
123
promises = args . flatten . map do |path |
124
124
Concurrent ::Promise . execute ( executor : executor ) do
125
- environment . find_all_linked_assets ( path ) do |asset |
125
+ environment . find_all_assets ( path ) do |asset |
126
126
yield asset
127
127
end
128
128
end
You can’t perform that action at this time.
0 commit comments