Improved assets cache handling
URLs of stylesheets and scripts are appended with current engine version. This forces browsers to aggressively refresh the assets regardless of any caching settings, whenever new version comes out.
This commit is contained in:
parent
3e426844a8
commit
dcce352ffd
1 changed files with 8 additions and 2 deletions
|
@ -16,12 +16,12 @@ class Assets extends \Chibi\Util\Assets
|
|||
|
||||
public function addStylesheet($path)
|
||||
{
|
||||
return parent::addStylesheet('/media/css/' . $path);
|
||||
return parent::addStylesheet($this->decorateUrl('/media/css/' . $path));
|
||||
}
|
||||
|
||||
public function addScript($path)
|
||||
{
|
||||
return parent::addScript('/media/js/' . $path);
|
||||
return parent::addScript($this->decorateUrl('/media/js/' . $path));
|
||||
}
|
||||
|
||||
public function transformHtml($html)
|
||||
|
@ -47,4 +47,10 @@ class Assets extends \Chibi\Util\Assets
|
|||
$html = str_replace('</body>', $bodySnippet . '</body>', $html);
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
private function decorateUrl($url)
|
||||
{
|
||||
return $url . '?' . PropertyModel::get(PropertyModel::EngineVersion);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue