You are here

public function LessphpCompiler::init in SCSS/Less Compiler 8

Calls a code on plugin initialization.

Overrides ScssCompilerPluginBase::init

File

src/Plugin/ScssCompiler/LessphpCompiler.php, line 32

Class

LessphpCompiler
Plugin implementation of the Less compiler.

Namespace

Drupal\scss_compiler\Plugin\ScssCompiler

Code

public function init() {
  $status = self::getStatus();
  if ($status !== TRUE) {
    throw new \Exception($status);
  }
  $this->parser = new \Less_Parser();
  $format = $this->scssCompiler
    ->getOption('output_format');
  switch ($format) {
    case 'compressed':
    case 'crunched':
      $this->parser
        ->setOption('compress', TRUE);
      break;
  }
}