summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-03-28 17:11:17 -0600
committerGitHub <noreply@github.com>2017-03-28 17:11:17 -0600
commit16b8c0c6913c7af0fecc7e814053df8a10ca66ef (patch)
treef2828cf21604948210d4cadae26d7910509ffe1d /lib/private
parent2c682ad34d13885ec1c0c784c2140fedfcf9c4cb (diff)
parent3a0ef65f332691177ee8449fce54296c80c69f1f (diff)
downloadnextcloud-server-16b8c0c6913c7af0fecc7e814053df8a10ca66ef.tar.gz
nextcloud-server-16b8c0c6913c7af0fecc7e814053df8a10ca66ef.zip
Merge pull request #4070 from nextcloud/gzip_scss_js
GZip generated CSS/JS files
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Template/JSCombiner.php7
-rw-r--r--lib/private/Template/SCSSCacher.php11
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index 9f92813f905..0f30fb915f7 100644
--- a/lib/private/Template/JSCombiner.php
+++ b/lib/private/Template/JSCombiner.php
@@ -155,8 +155,15 @@ class JSCombiner {
}
try {
+ $gzipFile = $folder->getFile($fileName . '.gz');
+ } catch (NotFoundException $e) {
+ $gzipFile = $folder->newFile($fileName . '.gz');
+ }
+
+ try {
$cachedfile->putContent($res);
$depFile->putContent(json_encode($deps));
+ $gzipFile->putContent(gzencode($res, 9));
return true;
} catch (NotPermittedException $e) {
return false;
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index c12d8771513..df2e0232508 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -186,9 +186,18 @@ class SCSSCacher {
return false;
}
+ // Gzip file
try {
- $cachedfile->putContent($this->rebaseUrls($compiledScss, $webDir));
+ $gzipFile = $folder->getFile($fileNameCSS . '.gz');
+ } catch (NotFoundException $e) {
+ $gzipFile = $folder->newFile($fileNameCSS . '.gz');
+ }
+
+ try {
+ $data = $this->rebaseUrls($compiledScss, $webDir);
+ $cachedfile->putContent($data);
$depFile->putContent(json_encode($scss->getParsedFiles()));
+ $gzipFile->putContent(gzencode($data, 9));
$this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']);
return true;
} catch(NotPermittedException $e) {