You are here

public function SassExtentionsCompassFunctionsUrls::font_url in Sassy 7

File

phamlp/sass/extensions/compass/functions/urls.php, line 34

Class

SassExtentionsCompassFunctionsUrls
Compass extension SassScript urls functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions

Code

public function font_url($path, $only_path = null) {
  $path = $path->value;

  # get to the string value of the literal.

  # Short circuit if they have provided an absolute url.
  if (self::is_absolute_path($path)) {
    return new SassString("url('{$path}')");
  }

  # 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.
  if (SassExtentionsCompassConfig::config('relative_assets')) {
    $http_fonts_path = self::compute_relative_path(SassExtentionsCompassConfig::config('fonts_path'));
  }
  else {
    $http_fonts_path = SassExtentionsCompassConfig::config('http_fonts_path');
  }
  return new SassString(self::clean("{$http_fonts_path}/{$path}", $only_path));
}