mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-06 21:35:49 +01:00
handle error on compile
This commit is contained in:
@@ -290,7 +290,11 @@ class AdminPlugin extends Plugin
|
|||||||
$obj = $event['object'];
|
$obj = $event['object'];
|
||||||
|
|
||||||
if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'admin/blueprints') {
|
if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'admin/blueprints') {
|
||||||
$this->grav['admin-whitebox']->compileScss($obj);
|
|
||||||
|
[$status, $msg] = $this->grav['admin-whitebox']->compileScss($obj);
|
||||||
|
if (!$status) {
|
||||||
|
$this->grav['messages']->add($msg, 'error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ class Whitebox
|
|||||||
$preset_in_path = $admin_in_base .'/preset.scss';
|
$preset_in_path = $admin_in_base .'/preset.scss';
|
||||||
$preset_out_path = $custom_out_base . '/'. $options['filename'] . '.css';
|
$preset_out_path = $custom_out_base . '/'. $options['filename'] . '.css';
|
||||||
|
|
||||||
|
try {
|
||||||
$this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path);
|
$this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return [false, $e->getMessage()];
|
||||||
|
}
|
||||||
|
|
||||||
return [true, 'Recompiled successfully'];
|
return [true, 'Recompiled successfully'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user