mirror of
https://github.com/flarum/core.git
synced 2025-10-15 17:04:26 +02:00
Clean up usages / deprecate path helpers (#2155)
* Write source map without creating temp file Less I/O, and one less place where we access the global path helpers. * Drop useless app_path() helper This was probably taken straight from Laravel. There is no equivalent concept in Flarum, so this should be safe to remove. * Deprecate global path helpers Developers using these helpers can inject the `Paths` class instead. * Stop storing paths as strings in container * Avoid using path helpers from Application class * Deprecate path helpers from Application class * Avoid using public_path() in prerequisite check a) The comparison was already outdated, as a different path was passed. b) We're trying to get rid of these global helpers.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
namespace Flarum\Frontend;
|
||||
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\Paths;
|
||||
use Flarum\Frontend\Compiler\Source\SourceCollector;
|
||||
use Flarum\Http\UrlGenerator;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
@@ -21,14 +22,16 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
$this->app->singleton('flarum.assets.factory', function () {
|
||||
return function (string $name) {
|
||||
$paths = $this->app[Paths::class];
|
||||
|
||||
$assets = new Assets(
|
||||
$name,
|
||||
$this->app->make('filesystem')->disk('flarum-assets'),
|
||||
$this->app['flarum']->storagePath()
|
||||
$paths->storage
|
||||
);
|
||||
|
||||
$assets->setLessImportDirs([
|
||||
$this->app['flarum']->vendorPath().'/components/font-awesome/less' => ''
|
||||
$paths->vendor.'/components/font-awesome/less' => ''
|
||||
]);
|
||||
|
||||
$assets->css([$this, 'addBaseCss']);
|
||||
|
Reference in New Issue
Block a user