Everytime I update my css or js files in infoweb\menu\module\assets, I have to empty the backend\web\assets folder
is there a way to automatically clear the assets cache?
When you need to invalidate all the stored cache data, you can call yii\caching\Cache::flush(). You can flush the cache from the console by calling yii cache/flush as well.
Simple Data Caching So we start by setting a value to be cached. To do so, we will also have to assign it a unique ID. For example: // Storing $value in Cache $value = "This is a variable that I am storing"; $id = "myValue"; $time = 30; // in seconds Yii::app()->cache->set($id, $value, $time);
Add this in your view:
use vendor\myVendorName\myPackageName\assets\AppAsset; AppAsset::register($this);
Add this in your config:
'components' => [ 'assetManager' => [ 'linkAssets' => true, ], ]
Empty assets folder, and refresh, done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With