Yii 1.1: csclientscript

Component that appends version to every JS/CSS link

When you are using "expires" headers with long in the future times, there can be problem with deploying changes, as some users can still be using cached CSS and JS files. You can change the name of such files every time, but this breaks code versioning.

Another solution provided by this extension is to append version (any string identifying version) as GET parametr to resources links, like:

<link rel="stylesheet" type="text/css" href="/css/site.css?v=1.0.1" />

then, after any change, you just increment version, and every browser will treat such link as new one and fetch file content.


There are no special requirements. It was tested with Yii 1.1.7 and 1.1.8.


Just expand Zip in your components directory (or any other) and append configuration:

  'clientScript' => array(

Total 3 comments

#6489 report it
Maciej Liżewski at 2012/01/13 10:46am

started using EClientScript and I think my extension will be abandoned. EClientScript provides same caching prevention on content change and also merging multiple js/css files into one... YSlow gives A+ ;)

#4536 report it
Veseliq at 2011/07/18 09:00am
Great Idea!

Man, I've run into this problem so many times. Thank you!

#4425 report it
Junior - df9 at 2011/07/07 06:22am

haven't tested yet, but it is something i'll use for sure in a near future!


Leave a comment

Please to leave your comment.

Create extension