You are here

function hook_scss_compiler_variables_alter in SCSS/Less Compiler 8

Alter compiler variables.

Parameters

\Drupal\scss_compiler\ScssCompilerAlterStorage $storage: Storage with variables.

1 invocation of hook_scss_compiler_variables_alter()
ScssCompilerService::getVariables in src/ScssCompilerService.php
Returns altering variables.

File

./scss_compiler.api.php, line 27
Hooks related to SCSS compiler module.

Code

function hook_scss_compiler_variables_alter(\Drupal\scss_compiler\ScssCompilerAlterStorage $storage) {

  // Alter variables in all files.
  $storage
    ->set([
    'mainColor' => '#f00',
  ]);

  // Alter variables based on module/theme name. As example alter variables in
  // all files which defined in my_module.
  $storage
    ->set([
    'mainColor' => '#f00',
  ], 'my_module');

  // Alter variables based on file path. As example alter variables on
  // styles.scss in my_module. Supports tokens like @my_module.
  $storage
    ->setByFile([
    'mainColor' => '#f00',
  ], 'modules/custom/my_module/styles.scss');
  $storage
    ->setByFile([
    'mainColor' => '#f00',
  ], '@my_module/styles.scss');
}