Change assets write directory on yii2 basic application template

[size="4"]Yii2 default write applications compile asset cache on /assets directory. [/size]

[size="4"]Where also default AppAsset class [AppAsset.php] or any other asset class files are located.[/size]

[size="4"]To separate our assets cache we can change assets cache write directory by override assetManager component in web.php on /config.[/size]

[size="2"]1.[/size] [size="4"]Create a directory at webroot or application root [ Example : /assets-cached ][/size]

[size="2"]2.[/size] [size="4"]Be sure it’s writeable.[/size]

[size="2"]3.[/size] O[size="4"]pen /config/web.php under component add following:[/size]




'assetManager' => [


                        'basePath'=>'@webroot/assets-cached',


                        'baseUrl'=>'@web/assets-cached'


],




[size="4"]Now we can clean your[/size] [size="4"]/assets-cached [/size][size="4"]directory when required. [/size]

[size="4"]most of time for clean CSS or JavaScript cache.[/size]