public static function SassFile::get_file in Sassy 7.3
Returns the full path to a file to parse. The file is looked for recursively under the load_paths directories and the template_location directory. If the filename does not end in .sass or .scss try the current syntax first then, if a file is not found, try the other syntax.
Parameters
string filename to find:
SassParser Sass parser:
Return value
array of string path(s) to file(s) or FALSE if no such file
2 calls to SassFile::get_file()
- SassImportNode::parse in phpsass/
tree/ SassImportNode.php - Parse this node. If the node is a CSS import return the CSS import rule. Else returns the rendered tree for the file.
- SassParser::parse in phpsass/
SassParser.php - Parse a sass file or Sass source code and returns the document tree that can then be rendered. The file will be searched for in the directories specified by the load_paths option. If caching is enabled a cached version will be used if possible or…
File
- phpsass/
SassFile.php, line 81
Class
- SassFile
- SassFile class. @package PHamlP @subpackage Sass
Code
public static function get_file($filename, $parser, $repass = TRUE) {
$ext = substr($filename, strrpos($filename, '.') + 1);
if (substr($filename, -1) != '*' && $ext !== self::SASS && $ext !== self::SCSS && $ext !== self::CSS) {
return self::get_file($filename . '.' . $parser->syntax, $parser);
}
if (file_exists($filename)) {
return array(
$filename,
);
}
$paths = $parser->load_paths;
if (is_string($parser->filename) && strlen($parser->filename)) {
$paths[] = dirname($parser->filename);
}
foreach ($paths as $path) {
$filepath = self::find_file($filename, realpath($path));
if ($filepath !== false) {
return array(
$filepath,
);
}
}
foreach ($parser->load_path_functions as $function) {
if (function_exists($function) && ($paths = call_user_func($function, $filename, $parser))) {
return $paths;
}
}
if ($repass) {
return self::get_file(self::resolve_paths(array(
1 => $filename,
), FALSE), $parser, FALSE);
}
return FALSE;
}