diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index 909d5304e..89a07b71b 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -99,7 +99,23 @@ $pathInfo = pathinfo($args[0]); $file->fileName = $pathInfo['basename']; $file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']); + $file->fileRealPath = FileHandler::getRealPath($pathInfo['dirname']); $file->fileExtension = strtolower($pathInfo['extension']); + $file->fileNameNoExt = preg_replace("/\.{$file->fileExtension}$/", '', $file->fileName); + + // Remove .min + $file->fileNameNoExt = preg_replace("/\.min$/", '', $file->fileNameNoExt); + $file->fileName = $file->keyName = "{$file->fileNameNoExt}.{$file->fileExtension}"; + + // if no debug mode load minified file + if(!__DEBUG__) + { + $tmp = "{$file->fileNameNoExt}.min.{$file->fileExtension}"; + if(file_exists("{$file->fileRealPath}/{$tmp}")) + { + $file->fileName = $tmp; + } + } if (strpos($file->filePath, '://') == false) { @@ -121,7 +137,7 @@ if (!$file->media) $file->media = 'all'; $map = &$this->cssMap; $mapIndex = &$this->cssMapIndex; - $key = $file->filePath . $file->fileName . "\t" . $file->targetIe . "\t" . $file->media; + $key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; $this->_arrangeCssIndex($pathInfo['dirname'], $file); } @@ -138,7 +154,7 @@ $map = &$this->jsHeadMap; $mapIndex = &$this->jsHeadMapIndex; } - $key = $file->filePath . $file->fileName . "\t" . $file->targetIe; + $key = $file->filePath . $file->keyName . "\t" . $file->targetIe; } (is_null($file->index))?$file->index=0:$file->index=$file->index;