Created
April 25, 2016 11:31
-
-
Save seoagentur-hamburg/51ebb155217f55cfff17ad1eb0a6dc98 to your computer and use it in GitHub Desktop.
Sorgt für die korrekte Versionierung der CSS-Dateien
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Automatische Versionierung der Dateinamen | |
* @param [[Type]] $file [[Description]] | |
* @return [[Type]] [[Description]] | |
*/ | |
function auto_version($file) | |
{ | |
if(strpos($file, '/') !== 0 || !file_exists($_SERVER['DOCUMENT_ROOT'] . $file)) | |
return $file; | |
$mtime = filemtime($_SERVER['DOCUMENT_ROOT'] . $file); | |
return preg_replace('{\\.([^./]+)$}', ".$mtime.\$1", $file); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment