public function LibsassCompiler::init in SCSS/Less Compiler 8
Calls a code on plugin initialization.
Overrides ScssCompilerPluginBase::init
File
- src/
Plugin/ ScssCompiler/ LibsassCompiler.php, line 66
Class
- LibsassCompiler
- Plugin implementation of the Libsass compiler.
Namespace
Drupal\scss_compiler\Plugin\ScssCompilerCode
public function init() {
$status = self::getStatus();
if ($status !== TRUE) {
throw new \Exception($status);
}
$module_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'scss_compiler');
$this->scriptPath = $module_path . '/js/libsass.js';
// Prevent the execution of the script if it contains changes.
if (hash_file('sha512', $this->scriptPath) !== self::SCRIPT_HASH || filesize($this->scriptPath) !== self::SCRIPT_SIZE) {
throw new \Exception($this
->t('Compiler initialization failed. The execution script is modified.'));
}
}