title: How do I register widget assets in Yii2?
body: <p>I want to create a custom widget in yii2 with its css and js files. Inside 'components' folder I've created a 'myWidget' folder and inside of it:
  - myWidget.php which extends yii\base\Widget.
  - myWidgetAsset.php which extends yii\web\AssetBundle.
  - views folder containing index.php file.
  - assets folder containing main.css and main.js files.</p>
  
  <p>Here are the codes: myWidget.php</p>
  
  <pre><code>namespace app\components\myWidget;
  
  use app\components\tablaFoS\tablaFoSAsset;
  use app\models\DisciplinesGrandesAreas;
  use yii\base\Widget;
  
  class myWidget extends Widget {
  
     public function run() {
      parent::run();
  
      return $this-&gt;render('index');
     }
  }
  </code></pre>
  
  <p>myWidgetAsset.php</p>
  
  <pre><code>namespace app\components\myWidget;
  
  use yii\web\AssetBundle;
  
  class myWidgetAsset extends AssetBundle {
  
      public $basePath = '@webroot';
      public $baseUrl = '@web';
      public $css = ['assets/main.css'];
      public $js = ['assets/main.js'];
      public $depends = [
      ];
  }
  </code></pre>
  
  <p>When I see the generated code I got:</p>
  
  <pre><code>&lt;link rel="stylesheet" href="/assets/main.css"&gt;&lt;/link&gt;
  &lt;script src="/assets/main.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>instead of something like e.g.bootstrap:</p>
  
  <pre><code>&lt;link href="/becyt/assets/67099f30/css/bootstrap.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>What am I doing wrong? What am I missing? Thanks in advance.</p>