title: Yii2 combine assets into one css and js
body: <p>I have a site based on the advanced app template, everything works fine except I want to combine all the css and js files into one. </p>
  
  <p>So I read <a href="https://github.com/yiisoft/yii2/blob/master/docs/guide/structure-assets.md" rel="nofollow">the official documentation</a> in order to combine assets. </p>
  
  <p>The problem:</p>
  
  <ul>
  <li>the bootstrap's js file in unminified and is included separately but the css file is compressed and combined perfectly (with the others)?</li>
  <li>how can I combine the assets included with a widget?</li>
  </ul>
  
  <p>Here is my assets.php (which is used with the php yii asset command)</p>
  
  <pre><code>Yii::setAlias('@webroot', __DIR__ . '/frontend/web');
  Yii::setAlias('@web', '/');
  
  return [
      // Adjust command/callback for JavaScript files compressing:
      'jsCompressor' =&gt; 'java -jar compiler.jar --js {from} --js_output_file {to}',
      // Adjust command/callback for CSS files compressing:
      'cssCompressor' =&gt; 'yui-compressor --type css {from} -o {to}',
      // The list of asset bundles to compress:
      'bundles' =&gt; [
          'yii\web\JqueryAsset',
          'yii\bootstrap\BootstrapAsset',
          'frontend\assets\AppAsset',
          'yii\web\YiiAsset',
          '\rmrevin\yii\fontawesome\AssetBundle',
      ],
      // Asset bundle for compression output:
      'targets' =&gt; [
          'all' =&gt; [
              'class' =&gt; 'yii\web\AssetBundle',
              'basePath' =&gt; '@webroot',
              'baseUrl' =&gt; '@web',
              'js' =&gt; 'js/all-{hash}.js',
              'css' =&gt; 'css/all-{hash}.css',
          ],
      ],
      // Asset manager configuration:
      'assetManager' =&gt; [
          'basePath' =&gt; '@webroot/assets',
          'baseUrl' =&gt; '@web/assets',
      ],
  ];
  </code></pre>