181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
# File 'lib/compass/core/sass_extensions/functions/urls.rb', line 181
def generated_image_url(path, cache_buster = bool(false))
path = path.value
if path =~ %r{^#{Regexp.escape(Compass.configuration.http_generated_images_path)}/(.*)}
path = $1
elsif absolute_path?(path)
return unquoted_string("url(#{path})")
end
http_generated_images_path = if relative?
compute_relative_path(Compass.configuration.generated_images_path)
elsif Compass.configuration.http_generated_images_path
Compass.configuration.http_generated_images_path
else
Compass.configuration.http_root_relative(Compass.configuration.generated_images_dir)
end
real_path = if Compass.configuration.generated_images_path
File.join(Compass.configuration.generated_images_path, path.gsub(/#.*$/,""))
else
File.join(Compass.configuration.project_path, path.gsub(/#.*$/,""))
end
if http_generated_images_path
http_generated_images_path = "#{http_generated_images_path}/" unless http_generated_images_path[-1..-1] == "/"
path = "#{http_generated_images_path}#{path}"
end
asset_host = if !relative? && Compass.configuration.asset_host
Compass.configuration.asset_host.call(path)
end
if cache_buster.to_bool
path, anchor = path.split("#", 2)
if cache_buster.is_a?(Sass::Script::Value::String)
path += "#{path["?"] ? "&" : "?"}#{cache_buster.value}"
else
path = cache_busted_path(path, real_path)
end
path = "#{path}#{"#" if anchor}#{anchor}"
end
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
clean_url(path)
end
|