Answer the question
In order to leave comments, you need to log in
How to change assets version after release in Yii2?
After releasing and clearing the assets folder, Yii2 creates a folder with the same name as before, despite the fact that the assets have changed. Accordingly, users have a cache. How to avoid it?
Answer the question
In order to leave comments, you need to log in
protected function publishDirectory($src, $options)
{
$dir = $this->hash($src . filemtime($src));
....
}
It is also interesting how this is done using the resource manager. I myself have always used the following trick: I specify the version number in the file path, for example, css/main.css?v=1.3
or js/main.js?v=2.29
the name of the directory in the assets folder - a hash that depends on the creation of the folder. Accordingly, by clearing the assets folder, you will recreate all the assets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question