public static compassUrl ( $path, $only_path = false, $web_path = true ) |
public static function compassUrl($path, $only_path = false, $web_path = true)
{
$opath = $path;
if (!($path = SassFile::get_file($path, SassParser::$instance, false))) {
throw new Exception('File not found: ' . $opath);
}
$path = $path[0];
if ($web_path) {
$webroot = realpath($_SERVER['DOCUMENT_ROOT']);
$path = str_replace($webroot, '', $path);
}
if ($only_path) {
return new SassString($path);
}
$path = str_replace(DIRECTORY_SEPARATOR, "/", $path);
return new SassString("url('{$path}')");
}