summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-02 23:37:27 +0200
committeremkael <emkael@tlen.pl>2016-05-02 23:37:27 +0200
commit6a4785982e854f61fc3e0d498ca3f4284b79acd8 (patch)
tree2fa954651f63f99598817dd282438bd17411f181 /app
parent94a5fa6b00f333b9b096d262c5a4dbf43a173934 (diff)
* CSS compression factored out to separate method
Diffstat (limited to 'app')
-rw-r--r--app/php/web/ClientScriptManager.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/app/php/web/ClientScriptManager.php b/app/php/web/ClientScriptManager.php
index 792961b..a0fe657 100644
--- a/app/php/web/ClientScriptManager.php
+++ b/app/php/web/ClientScriptManager.php
@@ -306,6 +306,16 @@ class ClientScriptManager extends TClientScriptManager {
);
}
+ private function _getCompressedSheet($origPath, $path) {
+ Prado::using('Lib.cssmin.CssMin');
+ return trim(CssMin::minify(
+ $this->_fixStyleSheetPaths(
+ file_get_contents($path),
+ $origPath
+ )
+ ));
+ }
+
private function _compileSheetFiles($files) {
$paths = $this->_getBasePaths(
array_map('reset', $files)
@@ -314,20 +324,10 @@ class ClientScriptManager extends TClientScriptManager {
$cacheFile = $this->_getCacheFilePath($cacheKey . '.css', 'styles');
$this->_appendRenderedSheets($files, $cacheFile);
if (!$this->_isCacheValid($cacheFile, $paths)) {
- Prado::using('Lib.cssmin.CssMin');
$styleContent = implode(
PHP_EOL,
array_map(
- function($origPath, $path) {
- return trim(
- CssMin::minify(
- $this->_fixStyleSheetPaths(
- file_get_contents($path),
- $origPath
- )
- )
- );
- },
+ [$this, '_getCompressedSheet'],
array_keys($paths),
$paths
)