Jarves\AssetHandler\ScssHandler::resolveDependencies PHP Method

resolveDependencies() public method

public resolveDependencies ( $localPath, array &$dependencies, &$seen = [], $relativeTo = null )
$dependencies array
    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);
            }
        }
    }