diff --git a/admin.php b/admin.php index 84194804..72b66982 100644 --- a/admin.php +++ b/admin.php @@ -290,7 +290,11 @@ class AdminPlugin extends Plugin $obj = $event['object']; 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'); + } } } diff --git a/classes/plugin/Whitebox.php b/classes/plugin/Whitebox.php index 742fcb24..f810e8d4 100644 --- a/classes/plugin/Whitebox.php +++ b/classes/plugin/Whitebox.php @@ -32,7 +32,11 @@ class Whitebox $preset_in_path = $admin_in_base .'/preset.scss'; $preset_out_path = $custom_out_base . '/'. $options['filename'] . '.css'; - $this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path); + try { + $this->compilePresetScss($color_scheme, $preset_in_path, $preset_out_path); + } catch (\Exception $e) { + return [false, $e->getMessage()]; + } return [true, 'Recompiled successfully'];