diff --git a/config/di-web.php b/config/di.php similarity index 89% rename from config/di-web.php rename to config/di.php index e370ad4..8d5440b 100644 --- a/config/di-web.php +++ b/config/di.php @@ -57,9 +57,14 @@ $assetManager = $assetManager ->withConverter($container->get(AssetConverterInterface::class)) - ->withPublisher($container->get(AssetPublisherInterface::class)) ; + if ($params['yiisoft/assets']['assetManager']['publisher'] !== null) { + $assetManager = $assetManager->withPublisher( + $container->get($params['yiisoft/assets']['assetManager']['publisher']) + ); + }; + $assetManager->registerMany($params['yiisoft/assets']['assetManager']['register']); return $assetManager; }, diff --git a/config/params.php b/config/params.php index fed5ce8..d8b7c7d 100644 --- a/config/params.php +++ b/config/params.php @@ -3,6 +3,7 @@ declare(strict_types=1); use Yiisoft\Assets\AssetLoaderInterface; +use Yiisoft\Assets\AssetPublisherInterface; use Yiisoft\Assets\Debug\AssetCollector; use Yiisoft\Assets\Debug\AssetLoaderInterfaceProxy; @@ -28,6 +29,7 @@ 'allowedBundleNames' => [], 'customizedBundles' => [], 'register' => [], + 'publisher' => AssetPublisherInterface::class, ], ], diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index c547c6d..e225420 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -50,7 +50,7 @@ private function getDiConfig(?array $params = null): array if ($params === null) { $params = $this->getParams(); } - return require dirname(__DIR__) . '/config/di-web.php'; + return require dirname(__DIR__) . '/config/di.php'; } private function getParams(): array