Skip to content

Commit b226ef3

Browse files
Fix assets. (#5)
1 parent 4fced22 commit b226ef3

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

src/BootstrapAsset.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public function init(): void
2020
{
2121
parent::init();
2222

23-
$assetBootstrap = YII_ENV === 'prod'
24-
? ['bootstrap.min.css', 'bootstrap.min.css.map'] : ['bootstrap.css', 'bootstrap.css.map'];
23+
$assetBootstrap = YII_ENV === 'prod' ? ['bootstrap.min.css'] : ['bootstrap.css'];
24+
$assetBootstrapMap = YII_ENV === 'prod' ? ['bootstrap.min.css.map'] : ['bootstrap.css.map'];
2525

2626
$this->css = $assetBootstrap;
27-
$this->publishOptions['only'] = $assetBootstrap;
27+
$this->publishOptions['only'] = array_merge($assetBootstrap, $assetBootstrapMap);
2828
}
2929
}

src/BootstrapPluginAsset.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public function init(): void
2727
{
2828
parent::init();
2929

30-
$assetBootstrapPlugin = YII_ENV === 'prod'
31-
? ['bootstrap.bundle.min.js', 'bootstrap.bundle.min.js.map'] : ['bootstrap.bundle.js', 'bootstrap.bundle.js.map'];
30+
$assetBootstrapPlugin = YII_ENV === 'prod' ? ['bootstrap.bundle.min.js'] : ['bootstrap.bundle.js'];
31+
$assetBootstrapPluginMap = YII_ENV === 'prod' ? ['bootstrap.bundle.min.js.map'] : ['bootstrap.bundle.js.map'];
3232

3333
$this->js = $assetBootstrapPlugin;
34-
$this->publishOptions['only'] = $assetBootstrapPlugin;
34+
$this->publishOptions['only'] = array_merge($assetBootstrapPlugin, $assetBootstrapPluginMap);
3535
}
3636
}

src/PopperAsset.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ public function init(): void
2020
{
2121
parent::init();
2222

23-
$assetPopper = YII_ENV === 'prod' ? ['popper.min.js', 'popper.min.js.map'] : ['popper.js', 'popper.js.map'];
23+
$assetPopper = YII_ENV === 'prod' ? ['popper.min.js'] : ['popper.js'];
24+
$assetPopperMap = YII_ENV === 'prod' ? ['popper.min.js.map'] : ['popper.js.map'];
2425

2526
$this->css = $assetPopper;
26-
$this->publishOptions['only'] = $assetPopper;
27+
$this->publishOptions['only'] = array_merge($assetPopper, $assetPopperMap);
2728
}
2829
}

tests/AssetTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public function testBootstrapAssetRegister(): void
4242
$result = $view->renderFile(__DIR__ . '/support/main.php');
4343

4444
$this->assertStringContainsString('bootstrap.css', $result);
45-
$this->assertStringContainsString('bootstrap.css.map', $result);
4645
}
4746

4847
public function testBootstrapCdnAssetSimpleDependency(): void
@@ -107,9 +106,7 @@ public function testBootstrapPluginAssetRegister(): void
107106
$result = $view->renderFile(__DIR__ . '/support/main.php');
108107

109108
$this->assertStringContainsString('bootstrap.css', $result);
110-
$this->assertStringContainsString('bootstrap.css.map', $result);
111109
$this->assertStringContainsString('bootstrap.bundle.js', $result);
112-
$this->assertStringContainsString('bootstrap.bundle.js.map', $result);
113110
}
114111

115112
public function testBootstrapPluginCdnAssetSimpleDependency(): void
@@ -180,7 +177,6 @@ public function testPopperAssetRegister(): void
180177
$result = $view->renderFile(__DIR__ . '/support/main.php');
181178

182179
$this->assertStringContainsString('popper.js', $result);
183-
$this->assertStringContainsString('popper.js.map', $result);
184180
}
185181

186182
public function testPopperCdnAssetSimpleDependency(): void

0 commit comments

Comments
 (0)