-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
Assets altındaki dosyalarda güncelleme olduğunda tarayıcı tarafından daha önceki dosyaların önbellekte tutulmasını engellemek için kullanılacak sınıf. Bu sınıf,
http://.../assets/css/default.css?123
http://.../assets/css/default.css?156mantığıyla ? sonrası gelen rakam değiştiği takdirde tekrar yüklemeye zorlamasıyla çalışmaktadır.
class ApplicationAssets {
const ASSETSPATH = "/app/assets/";
public static function css($file) {
$file = self::ASSETSPATH . "css/" . $file;
return self::_no_cache($file);
}
public static function js($file) {
$file = self::ASSETSPATH . "js/" . $file;
return self::_no_cache($file);
}
public static function font($file) {
$file = self::ASSETSPATH . "font/" . $file;
return self::_no_cache($file);
}
private static function _no_cache($file) {
return $file . "?" . md5(filemtime($file));
}
}