You are here

protected function ScssCompilerService::getNamespacePath in SCSS/Less Compiler 8

Returns namespace path.

Parameters

string $namespace: Namespace name.

Return value

string Path to theme/module of given namespace.

Throws

Exception If namespace is invalid.

2 calls to ScssCompilerService::getNamespacePath()
ScssCompilerService::buildCompilationFileInfo in src/ScssCompilerService.php
Returns compile file info.
ScssCompilerService::replaceTokens in src/ScssCompilerService.php
Replace path tokens into real path.

File

src/ScssCompilerService.php, line 377

Class

ScssCompilerService
Defines a class for scss compiler service.

Namespace

Drupal\scss_compiler

Code

protected function getNamespacePath($namespace) {
  if (isset($this->tokens[$namespace])) {
    return $this->tokens[$namespace];
  }
  $type = 'theme';
  if ($this->moduleHandler
    ->moduleExists($namespace)) {
    $type = 'module';
  }
  $path = @drupal_get_path($type, $namespace);
  if (empty($path)) {
    $path = '';
  }
  $this->tokens[$namespace] = $path;
  return $path;
}