public function resolveDependencies($localPath, array &$dependencies, &$seen = [], $relativeTo = null)
{
$localPath = realpath($localPath);
$content = file_get_contents($localPath);
$found = [];
preg_match_all('/@import \'(?!.*:\\/\\/)([^\\/].*)\'/', $content, $matches);
$found = array_merge($found, $matches[1]);
preg_match_all('/@import "(?!.*:\\/\\/)([^\\/].*)"/', $content, $matches);
$found = array_merge($found, $matches[1]);
foreach ($found as $name) {
if ('.scss' !== substr($name, -5)) {
$name .= '.scss';
}
$path = dirname($localPath) . '/' . $name;
if (isset($seen[$path])) {
continue;
}
$seen[$path] = true;
if (file_exists($path)) {
$dependencies[] = Tools::getRelativePath($path, dirname($relativeTo ?: $localPath)) . ':' . filemtime($path);
$this->resolveDependencies($path, $dependencies, $seen, $localPath);
}
}
}