tccltd/tcc-cache-buster
最新稳定版本:1.1.1
Composer 安装命令:
composer require tccltd/tcc-cache-buster
包简介
TccCacheBuster Package
README 文档
README
This module automatically inserts a version number into the head links and head scripts you have on your pages. The version number is pulled from the applicaiton config.
return [ 'version' => '1.1.1', ];
This will lead to a head link like /css/my-css-file.1.1.1.css
If you don't specify a version number nothing happens so can be used in development and then the buildscript for a production environment can insert a config file into the applications config/autoload directory.
A minor addition needs to be made to the apache .htaccess file to allow this to work using ModRewrite...
# Capture version bumping of files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.([0-9]+\.[0-9]+\.[0-9]+)\.(js|css|png|jpg|gif)$ /$1.$3 [L]
(Note: With the above you can also version images but this module does not automatically do this).
Why do I need this?
If you web server is set to cache js/css files in a users browser and you release a new version the browser will pull files from cache rather than download new version from the server.
By altering the version number of the file requested the browser downloads a new version from the server when the files have changed.
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-05-21