[Compass Core] Fixed a bug in inlint-font-files().

This commit is contained in:
Chris Eppstein 2010-07-20 01:23:34 -07:00
parent b85c6f68f5
commit 6289fa1de1

View File

@ -14,14 +14,14 @@ module Compass::SassExtensions::Functions::InlineImage
while args.size > 0 while args.size > 0
path = args.shift.value path = args.shift.value
real_path = File.join(Compass.configuration.fonts_path, path) real_path = File.join(Compass.configuration.fonts_path, path)
url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')" url = "url('data:#{compute_mime_type(path)};base64,#{data(real_path)}')"
files << "#{url} format('#{args.shift}')" files << "#{url} format('#{args.shift}')"
end end
Sass::Script::String.new(files.join(", ")) Sass::Script::String.new(files.join(", "))
end end
private private
def compute_mime_type(path, mime_type) def compute_mime_type(path, mime_type = nil)
return mime_type if mime_type return mime_type if mime_type
case path case path
when /\.png$/i when /\.png$/i