C
C
Cyril2017-08-22 12:40:42
css
Cyril, 2017-08-22 12:40:42

How to make CSS and JavaScript files included with "version" in YII2?

I noticed that after changing some CSS and JavaScript files, not all site visitors see these changes... Some people have old "versions" of files in the browser cache. I use YII2 as a backend.
How to make YII2 include (include) JavaScript and CSS files with "version"? In this form:

<script src="/resources/my_script.js?3868294767"></script>

So that after I upload a CSS or JavaScript file to the server, YII sees that the file has changed and changes the number 3868294767 to another one.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-08-22
@slo_nik

Good afternoon.
In configuration components->assetManager->'appendTimestamp' => true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question