public static function SassFile::find_file in Sassy 7.3
Looks for the file recursively in the specified directory. This will also look for _filename to handle Sass partials.
Parameters
string filename to look for:
string path to directory to look in and under:
Return value
mixed string: full path to file if found, false if not
1 call to SassFile::find_file()
- SassFile::get_file in phpsass/
SassFile.php - 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…
File
- phpsass/
SassFile.php, line 118
Class
- SassFile
- SassFile class. @package PHamlP @subpackage Sass
Code
public static function find_file($filename, $dir) {
$partialname = dirname($filename) . DIRECTORY_SEPARATOR . '_' . basename($filename);
foreach (array(
$filename,
$partialname,
) as $file) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) {
return realpath($dir . DIRECTORY_SEPARATOR . $file);
}
}
if (is_dir($dir)) {
$files = array_slice(scandir($dir), 2);
foreach ($files as $file) {
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
$path = self::find_file($filename, $dir . DIRECTORY_SEPARATOR . $file);
if ($path !== false) {
return $path;
}
}
}
// foreach
}
return false;
}