1
0
mirror of https://github.com/flarum/core.git synced 2025-07-24 02:01:19 +02:00
Files
php-flarum/src/Forum/Controller/ClientController.php
Toby Zerner 6f1c46819e 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.
2015-10-09 01:52:51 +10:30

71 lines
1.5 KiB
PHP

<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Forum\Controller;
use Flarum\Api\Client;
use Flarum\Formatter\Formatter;
use Flarum\Foundation\Application;
use Flarum\Settings\SettingsRepository;
use Flarum\Locale\LocaleManager;
use Flarum\Http\Controller\AbstractClientController;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Contracts\Events\Dispatcher;
class ClientController extends AbstractClientController
{
/**
* {@inheritdoc}
*/
protected $clientName = 'forum';
/**
* {@inheritdoc}
*/
protected $translationKeys = ['core.forum', 'core.lib'];
/**
* @var Formatter
*/
protected $formatter;
/**
* {@inheritdoc}
*/
public function __construct(
Application $app,
Client $api,
LocaleManager $locales,
SettingsRepository $settings,
Dispatcher $events,
Repository $cache,
Formatter $formatter
) {
parent::__construct($app, $api, $locales, $settings, $events, $cache);
$this->layout = __DIR__.'/../../../views/forum.blade.php';
$this->formatter = $formatter;
}
/**
* @inheritdoc
*/
protected function getAssets()
{
$assets = parent::getAssets();
$assets->addJs(function () {
return $this->formatter->getJs();
});
return $assets;
}
}