1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 18:26:07 +02:00

Refactor frontend code to allow for extension of assets

- Simpler class naming:
    Frontend\CompilerFactory → Frontend\Assets
    Frontend\HtmlDocumentFactory → Frontend\Frontend
    Frontend\HtmlDocument → Frontend\Document

- Remove AssetInterface and simply collect callbacks in Frontend\Assets
  instead

- Remove ContentInterface because it serves no purpose (never type-
  hinted or type-checked)

- Commit and add asset URLs to the Document via a content callback
  instead of in the Document factory class itself

- Add translations and locale assets to Assets separate to the assets
  factory, as non-forum/admin asset bundles probably won't want them

- Update Frontend Extender to allow the creation of new asset bundles

- Make custom LESS validation listener a standalone class instead of
  extending RecompileFrontendAssets
This commit is contained in:
Toby Zerner
2018-11-16 13:54:13 +10:30
parent 9e63f32105
commit edaca3160e
34 changed files with 519 additions and 946 deletions

View File

@@ -12,8 +12,7 @@
namespace Flarum\Admin\Content;
use Flarum\Extension\ExtensionManager;
use Flarum\Frontend\Content\ContentInterface;
use Flarum\Frontend\HtmlDocument;
use Flarum\Frontend\Document;
use Flarum\Group\Permission;
use Flarum\Settings\Event\Deserializing;
use Flarum\Settings\SettingsRepositoryInterface;
@@ -21,7 +20,7 @@ use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Database\ConnectionInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
class AdminPayload implements ContentInterface
class AdminPayload
{
/**
* @var SettingsRepositoryInterface
@@ -52,7 +51,7 @@ class AdminPayload implements ContentInterface
$this->events = $events;
}
public function __invoke(HtmlDocument $document, Request $request)
public function __invoke(Document $document, Request $request)
{
$settings = $this->settings->all();