You are here

public function ScssCompilerService::setCompileList in SCSS/Less Compiler 8

Saves list of scss files which need to be recompiled.

Parameters

array $files: List of scss files.

Overrides ScssCompilerInterface::setCompileList

File

src/ScssCompilerService.php, line 204

Class

ScssCompilerService
Defines a class for scss compiler service.

Namespace

Drupal\scss_compiler

Code

public function setCompileList(array $files) {

  // Save list of scss files which need to be recompiled to the cache.
  // Each theme has own list of files, to prevent recompile files
  // which not loaded in active theme.
  $data = [];
  if ($cache = $this->cache
    ->get('scss_compiler_list')) {
    $data = $cache->data;
    if (!empty($data[$this->activeThemeName])) {
      $old_files = $data[$this->activeThemeName];
      if (is_array($old_files)) {
        $files = array_replace_recursive($old_files, $files);
      }
    }
  }
  $data[$this->activeThemeName] = $files;
  $this->cache
    ->set('scss_compiler_list', $data, CacheBackendInterface::CACHE_PERMANENT);
}