Yii2 Composer manage package in bower and bower-vendor

后端 未结 3 1609
感情败类
感情败类 2021-01-26 07:44

I have been using yii2 for sometime now but i cant wrap my head around how to manage my packages. I have two issues in these regard.

  1. when i add a package to yii

3条回答
  •  我在风中等你
    2021-01-26 08:34

    This is how we register booty assets.

    namespace backend\assets;
    
    
    use yii\web\AssetBundle;
    
    class BootstrapAsset extends AssetBundle
    {
        public $sourcePath = '@bower/bootstrap/dist';
        public $js         = [
            'js/bootstrap.min.js',
        ];
    }
    

    And Register this asset in your layout as:

    $asset     = AppAsset::register($this);
    $bootstrap = \backend\assets\BootstrapAsset::register($this);
    

    Hope this will give a hint.

提交回复
热议问题