diff --git a/src/BootstrapAsset.php b/src/BootstrapAsset.php index 2e59d22..76360be 100644 --- a/src/BootstrapAsset.php +++ b/src/BootstrapAsset.php @@ -9,7 +9,7 @@ /** * Twitter Bootstrap 5 CSS bundle. */ -class BootstrapAsset extends AssetBundle +final class BootstrapAsset extends AssetBundle { /** * @inheritDoc @@ -20,9 +20,11 @@ public function init(): void { parent::init(); - $assetBootstrap = YII_ENV === 'prod' ? 'bootstrap.min.css' : 'bootstrap.css'; + $assetBootstrap = YII_ENV === 'prod' + ? ['bootstrap.min.css', 'bootstrap.min.css.map'] + : ['bootstrap.css', 'bootstrap.css.map']; - $this->js[] = $assetBootstrap; - $this->publishOptions['only'] = [$assetBootstrap]; + $this->css = $assetBootstrap; + $this->publishOptions['only'] = $assetBootstrap; } } diff --git a/src/BootstrapPluginAsset.php b/src/BootstrapPluginAsset.php index 973bd91..aa7b067 100644 --- a/src/BootstrapPluginAsset.php +++ b/src/BootstrapPluginAsset.php @@ -9,7 +9,7 @@ /** * Twitter Bootstrap 5 JavaScript bundle. */ -class BootstrapPluginAsset extends AssetBundle +final class BootstrapPluginAsset extends AssetBundle { /** * @inheritDoc @@ -27,9 +27,11 @@ public function init(): void { parent::init(); - $assetBootstrapPlugin = YII_ENV === 'prod' ? 'bootstrap.bundle.min.js' : 'bootstrap.bundle.js'; + $assetBootstrapPlugin = YII_ENV === 'prod' + ? ['bootstrap.bundle.min.js', 'bootstrap.bundle.min.js.map'] + : ['bootstrap.bundle.js', 'bootstrap.bundle.js.map']; - $this->js[] = $assetBootstrapPlugin; - $this->publishOptions['only'] = [$assetBootstrapPlugin]; + $this->js = $assetBootstrapPlugin; + $this->publishOptions['only'] = $assetBootstrapPlugin; } } diff --git a/tests/AssetTest.php b/tests/AssetTest.php index ece90da..6c2a3d8 100644 --- a/tests/AssetTest.php +++ b/tests/AssetTest.php @@ -46,7 +46,8 @@ public function testBootstrapAssetRegister(): void $result = $view->renderFile(__DIR__ . '/support/main.php'); - $this->assertMatchesRegularExpression('/bootstrap.css/', $result); + $this->assertStringContainsString('bootstrap.css', $result); + $this->assertStringContainsString('bootstrap.css.map', $result); } public function testBootstrapPluginAssetSimpleDependency(): void @@ -86,8 +87,10 @@ public function testBootstrapPluginAssetRegister(): void $result = $view->renderFile(__DIR__ . '/support/main.php'); - $this->assertMatchesRegularExpression('/bootstrap.css/', $result); - $this->assertMatchesRegularExpression('/bootstrap.bundle.js/', $result); + $this->assertStringContainsString('bootstrap.css', $result); + $this->assertStringContainsString('bootstrap.css.map', $result); + $this->assertStringContainsString('bootstrap.bundle.js', $result); + $this->assertStringContainsString('bootstrap.bundle.js.map', $result); } private function sourcesPublishVerifyFiles(string $type, object $bundle): void