Some notes on asset publishing

One huge benefit of using asset publishing is it allows easy asset management when the folder structure in local dev environment is different from production.

For example, on local environment the css files could be located at /yii/assets/css . This folder is also web accesssible.

On production this might be different. /yii/assets/css is not web accessible and /yii/public_html/css is.

/yii/public_html/css might not be under source controll tools. Therefore we need to use asset publishing to automatically update files under this folder.

Reference: http://stackoverflow.com/questions/25686904/how-do-i-manage-assets-in-yii2

Note that Yii 2.0 will publish assets only if $sourcePath is set, and $basePath and $baseUrl are not set

use yii\web\AssetBundle;

class AppAsset extends AssetBundle
{
    public $sourcePath = '@app/assets/app';

    public $css = [
        'css/openbook.css',
        'fontello/css/fontello.css',
        'fontello/css/animation.css'
    ];

    public $depends = [
       // 'yii\web\YiiAsset', 
       // 'yii\bootstrap\BootstrapAsset',
    ];
}