js, css 캐시 문제로 printJS, printCSS 함수를 이용하도록 변경

This commit is contained in:
2018-05-12 16:09:32 +09:00
parent 451a759cca
commit 288be33eac
80 changed files with 330 additions and 2844 deletions
+37
View File
@@ -88,4 +88,41 @@ class WebUtil
return $decoded;
}
public function printJS(string $path){
//async, defer 옵션 고려
$upath = \phpUri::parse($path);
$path = $upath->join();
if(!$upath->scheme && file_exists($upath->path)){
$mtime = filemtime($upath->path);
if($upath->query){
$tail = '&'.$mtime;
}
else{
$tail = '?'.$mtime;
}
}
else{
$tail = '';
}
return "<script src='{$path}{$tail}'></script>\n";
}
public function printCSS(string $path){
$upath = \phpUri::parse($path);
$path = $upath->join();
if(!$upath->scheme && file_exists($upath->path)){
$mtime = filemtime($upath->path);
if($upath->query){
$tail = '&'.$mtime;
}
else{
$tail = '?'.$mtime;
}
}
else{
$tail = '';
}
return "<link rel='stylesheet' type='text/css' href='{$path}{$tail}' />\n";
}
}