mirror of
https://github.com/flarum/core.git
synced 2025-10-12 07:24:27 +02:00
Minify each JS file individually, caching the result
This means that the expensive minification process will only be run for a file if it hasn't before. Greatly speeds up extension enabling/disabling. Also: - Don't check file last modification times in production for a bit of extra perf. - Only flush CSS when theme settings are changed. This speeds up the page reload a bit.
This commit is contained in:
@@ -148,7 +148,7 @@ class ForumServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
$this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) {
|
||||
if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
|
||||
$this->flushAssets();
|
||||
$this->getClientController()->flushCss();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -163,7 +163,14 @@ class ForumServiceProvider extends AbstractServiceProvider
|
||||
|
||||
public function flushAssets()
|
||||
{
|
||||
$controller = $this->app->make('Flarum\Forum\Controller\ClientController');
|
||||
$controller->flushAssets();
|
||||
$this->getClientController()->flushAssets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Flarum\Forum\Controller\ClientController
|
||||
*/
|
||||
protected function getClientController()
|
||||
{
|
||||
return $this->app->make('Flarum\Forum\Controller\ClientController');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user