You are here

protected function StaticGenerator::getRealPaths in Tome 8

Turns relative paths into absolute paths.

Useful specifically for CSS's url().

Parameters

array $paths: An array of paths to convert.

string $root: A root path to resolve relative paths.

Return value

array An array of converted paths.

1 call to StaticGenerator::getRealPaths()
StaticGenerator::getCssAssets in modules/tome_static/src/StaticGenerator.php
Finds assets for the given CSS content.

File

modules/tome_static/src/StaticGenerator.php, line 364

Class

StaticGenerator
Handles static site generation.

Namespace

Drupal\tome_static

Code

protected function getRealPaths(array $paths, $root) {
  $root_dir = dirname($this
    ->sanitizePath($root));
  foreach ($paths as &$path) {
    if (strpos($path, '../') !== FALSE) {
      $path = $this
        ->joinPaths($root_dir, $path);
    }
  }
  return $paths;
}