lib/compass/sass_extensions/functions/urls.rb in compass-edge-0.9.4 vs lib/compass/sass_extensions/functions/urls.rb in compass-edge-0.9.5.0

- old
+ new

@@ -12,11 +12,31 @@ end url("#{http_stylesheets_path}/#{path}") end + def font_url(path) + path = path.value # get to the string value of the literal. + + # Short curcuit if they have provided an absolute url. + if absolute_path?(path) + return Sass::Script::String.new("url(#{path})") + end + + # Compute the path to the font file, either root relative or stylesheet relative + # or nil if the http_fonts_path cannot be determined from the configuration. + http_fonts_path = if relative? + compute_relative_path(Compass.configuration.fonts_dir) + else + Compass.configuration.http_fonts_path + end + + url("#{http_fonts_path}/#{path}") + end + def image_url(path) path = path.value # get to the string value of the literal. + # Short curcuit if they have provided an absolute url. if absolute_path?(path) return Sass::Script::String.new("url(#{path})") end