Yii2资产清除缓存 [英] Yii2 assets clear cache

查看:71
本文介绍了Yii2资产清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我更新infoweb \ menu \ module \ assets中的css或js文件时,都必须清空backend \ web \ assets文件夹
有没有一种方法可以自动清除资产缓存?

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?

推荐答案

在您的视图中添加它:

use vendor\myVendorName\myPackageName\assets\AppAsset;
AppAsset::register($this);

将此添加到您的配置中:

Add this in your config:

'components' => [
    'assetManager' => [
        'linkAssets' => true,
    ], 
]  

清空资产文件夹,并刷新完成

Empty assets folder, and refresh, done

这篇关于Yii2资产清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆