Skip to content

Commit

Permalink
Fix assets. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Nov 18, 2023
1 parent 4fced22 commit b226ef3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/BootstrapAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function init(): void
{
parent::init();

$assetBootstrap = YII_ENV === 'prod'
? ['bootstrap.min.css', 'bootstrap.min.css.map'] : ['bootstrap.css', 'bootstrap.css.map'];
$assetBootstrap = YII_ENV === 'prod' ? ['bootstrap.min.css'] : ['bootstrap.css'];
$assetBootstrapMap = YII_ENV === 'prod' ? ['bootstrap.min.css.map'] : ['bootstrap.css.map'];

$this->css = $assetBootstrap;
$this->publishOptions['only'] = $assetBootstrap;
$this->publishOptions['only'] = array_merge($assetBootstrap, $assetBootstrapMap);
}
}
6 changes: 3 additions & 3 deletions src/BootstrapPluginAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public function init(): void
{
parent::init();

$assetBootstrapPlugin = YII_ENV === 'prod'
? ['bootstrap.bundle.min.js', 'bootstrap.bundle.min.js.map'] : ['bootstrap.bundle.js', 'bootstrap.bundle.js.map'];
$assetBootstrapPlugin = YII_ENV === 'prod' ? ['bootstrap.bundle.min.js'] : ['bootstrap.bundle.js'];
$assetBootstrapPluginMap = YII_ENV === 'prod' ? ['bootstrap.bundle.min.js.map'] : ['bootstrap.bundle.js.map'];

$this->js = $assetBootstrapPlugin;
$this->publishOptions['only'] = $assetBootstrapPlugin;
$this->publishOptions['only'] = array_merge($assetBootstrapPlugin, $assetBootstrapPluginMap);
}
}
5 changes: 3 additions & 2 deletions src/PopperAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ public function init(): void
{
parent::init();

$assetPopper = YII_ENV === 'prod' ? ['popper.min.js', 'popper.min.js.map'] : ['popper.js', 'popper.js.map'];
$assetPopper = YII_ENV === 'prod' ? ['popper.min.js'] : ['popper.js'];
$assetPopperMap = YII_ENV === 'prod' ? ['popper.min.js.map'] : ['popper.js.map'];

$this->css = $assetPopper;
$this->publishOptions['only'] = $assetPopper;
$this->publishOptions['only'] = array_merge($assetPopper, $assetPopperMap);
}
}
4 changes: 0 additions & 4 deletions tests/AssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function testBootstrapAssetRegister(): void
$result = $view->renderFile(__DIR__ . '/support/main.php');

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

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

$this->assertStringContainsString('bootstrap.css', $result);
$this->assertStringContainsString('bootstrap.css.map', $result);
$this->assertStringContainsString('bootstrap.bundle.js', $result);
$this->assertStringContainsString('bootstrap.bundle.js.map', $result);
}

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

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

public function testPopperCdnAssetSimpleDependency(): void
Expand Down

0 comments on commit b226ef3

Please sign in to comment.