From db6208a2d7a55826c4e3e098271434a922ff733c Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 13 Oct 2022 15:13:20 +0300 Subject: [PATCH] Update BootstrapPluginAsset (#51) * Update BootstrapPluginAsset - Load minified JS on production - Optimize list of publishes files - Normalize comments * Update BootstrapPluginAsset.php * Update BootstrapPluginAsset.php * Update CHANGELOG.md --- CHANGELOG.md | 1 + src/BootstrapPluginAsset.php | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b420975..f690a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Yii Framework 2 bootstrap5 extension Change Log - Enh #40: Breadcrumbs refactoring (WinterSilence) - Bug #46: Fix data-attribute usage for Dropdown toggle (machour) - Enh #48: Update `BootstrapWidgetTrait` to initialize JS plugins without jQuery (WinterSilence) +- Bug #51: Update `BootstrapPluginAsset` to load minified JS on production, optimize and fix list of publishes files (WinterSilence) - Bug #52: Update `BootstrapAsset` to load minified CSS on production, optimize and fix list of publishes files (WinterSilence) diff --git a/src/BootstrapPluginAsset.php b/src/BootstrapPluginAsset.php index f194edb..a3558ef 100644 --- a/src/BootstrapPluginAsset.php +++ b/src/BootstrapPluginAsset.php @@ -1,8 +1,8 @@ + * Twitter Bootstrap 5 JavaScript bundle. */ class BootstrapPluginAsset extends AssetBundle { - public $sourcePath = '@bower/bootstrap/dist'; + /** + * @inheritDoc + */ + public $sourcePath = '@bower/bootstrap'; + /** + * @inheritDoc + */ public $js = [ - 'js/bootstrap.bundle.js', + YII_ENV_PROD ? 'dist/js/bootstrap.bundle.min.js' : 'dist/js/bootstrap.bundle.js' ]; + /** + * @inheritDoc + */ + public $publishOptions = [ + 'only' => ['dist/js/bootstrap.bundle.*', 'js/src/*.js', 'js/src/*/*.js'] + ]; + /** + * @inheritDoc + */ public $depends = [ - BootstrapAsset::class, + BootstrapAsset::class ]; }