csclientscript Component that appends version to every JS/CSS link

  1. Requirements
  2. Usage

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:

[html]
<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.

Requirements

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

Usage

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

'components'=>array(
  ...
  'clientScript' => array(
    'class'=>'CSClientScript',
    'version'=>'1.0.3'
  ),
  ...
8 0
11 followers
555 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Caching
Tags:
Developed by: Maciej Liżewski
Created on: Jul 7, 2011
Last updated: 6 years ago

Downloads

show all