K
K
Ken Jee2016-09-23 15:21:22
Yii
Ken Jee, 2016-09-23 15:21:22

How to add custom version to JS and CSS file path in Yii2?

In a Yii2 project, you need to integrate a pseudo version of CSS and JS into the download URL. In the example below, v-1.2 is an auto-populated arbitrary value.

<script src="/js/lib/v-1.2/jquery.min.js"></script>

This is necessary to bypass caching on the client side.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2016-09-23
@Machez

if you understand the task correctly, then you can do this:
1. Move the resource files to the appropriate AssetBundle, and connect it in the right places
2. Set the appendTimestamp property to true in the AssetManager.
After these steps, after each publication of resources, the corresponding version will be added

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question