mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-03-06 12:31:49 +01:00
fixes for scss and autoloading
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -1323,15 +1323,16 @@ class AdminController extends AdminBaseController
|
||||
$result = Gpm::install(array_keys($dependencies), ['theme' => $type === 'themes']);
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = ['status' => 'success', 'message' => 'Dependencies installed successfully'];
|
||||
$json_response = ['status' => 'success', 'message' => 'Dependencies installed successfully'];
|
||||
} else {
|
||||
$this->admin->json_response = [
|
||||
$json_response = [
|
||||
'status' => 'error',
|
||||
'message' => $this->admin::translate('PLUGIN_ADMIN.INSTALLATION_FAILED')
|
||||
];
|
||||
}
|
||||
|
||||
return true;
|
||||
// Exit early to prevent any post-install code from running with potentially mismatched autoloaders
|
||||
$this->sendJsonResponse($json_response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1376,19 +1377,20 @@ class AdminController extends AdminBaseController
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
$this->admin->json_response = [
|
||||
$json_response = [
|
||||
'status' => 'success',
|
||||
'message' => $this->admin::translate(is_string($result) ? $result : sprintf($this->admin::translate($reinstall ?: 'PLUGIN_ADMIN.PACKAGE_X_REINSTALLED_SUCCESSFULLY',
|
||||
null), $package))
|
||||
];
|
||||
} else {
|
||||
$this->admin->json_response = [
|
||||
$json_response = [
|
||||
'status' => 'error',
|
||||
'message' => $this->admin::translate($reinstall ?: 'PLUGIN_ADMIN.INSTALLATION_FAILED')
|
||||
];
|
||||
}
|
||||
|
||||
return true;
|
||||
// Exit early to prevent any post-install code from running with potentially mismatched autoloaders
|
||||
$this->sendJsonResponse($json_response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1501,19 +1503,20 @@ class AdminController extends AdminBaseController
|
||||
$result = Gpm::directInstall($url);
|
||||
|
||||
if ($result === true) {
|
||||
$this->admin->json_response = [
|
||||
$json_response = [
|
||||
'status' => 'success',
|
||||
'message' => $this->admin::translate(sprintf($this->admin::translate('PLUGIN_ADMIN.PACKAGE_X_REINSTALLED_SUCCESSFULLY',
|
||||
null), $package_name))
|
||||
];
|
||||
} else {
|
||||
$this->admin->json_response = [
|
||||
$json_response = [
|
||||
'status' => 'error',
|
||||
'message' => $this->admin::translate('PLUGIN_ADMIN.REINSTALLATION_FAILED')
|
||||
];
|
||||
}
|
||||
|
||||
return true;
|
||||
// Exit early to prevent any post-install code from running with potentially mismatched autoloaders
|
||||
$this->sendJsonResponse($json_response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,20 @@ class WhiteLabel
|
||||
public function __construct()
|
||||
{
|
||||
$this->grav = Grav::instance();
|
||||
$this->scss = new ScssCompiler();
|
||||
// ScssCompiler is now lazy-loaded to avoid loading scssphp classes until actually needed
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ScssCompiler instance (lazy-loaded)
|
||||
*
|
||||
* @return ScssCompiler
|
||||
*/
|
||||
protected function getScss(): ScssCompiler
|
||||
{
|
||||
if ($this->scss === null) {
|
||||
$this->scss = new ScssCompiler();
|
||||
}
|
||||
return $this->scss;
|
||||
}
|
||||
|
||||
public function compilePresetScss($config, $options = [
|
||||
@@ -61,7 +74,7 @@ class WhiteLabel
|
||||
}
|
||||
|
||||
try {
|
||||
$compiler = $this->scss->reset();
|
||||
$compiler = $this->getScss()->reset();
|
||||
|
||||
$compiler->setVariables($color_scheme['colors'] + $color_scheme['accents']);
|
||||
$compiler->setImportPaths($imports);
|
||||
|
||||
Reference in New Issue
Block a user