diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2016-11-08 13:36:35 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-01-06 09:42:13 +0100 |
commit | 31f75e50b67050c09368805ef911569bcaceeeeb (patch) | |
tree | 939a533a6974bc49a0e3060d162c197ddc0aa13a /lib/private/Template/ResourceLocator.php | |
parent | 460ef39b18222dab5452b3dd50a6753060ba3de1 (diff) | |
download | nextcloud-server-31f75e50b67050c09368805ef911569bcaceeeeb.tar.gz nextcloud-server-31f75e50b67050c09368805ef911569bcaceeeeb.zip |
Cache and compile base
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/Template/ResourceLocator.php')
-rwxr-xr-x[-rw-r--r--] | lib/private/Template/ResourceLocator.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php index 420317d27ac..37360a98d91 100644..100755 --- a/lib/private/Template/ResourceLocator.php +++ b/lib/private/Template/ResourceLocator.php @@ -107,6 +107,33 @@ abstract class ResourceLocator { } /** + * cache and append the scss $file if exist at $root + * + * @param string $root path to check + * @param string $file the filename + * @param string|null $webRoot base for path, default map $root to $webRoot + * @return bool True if the resource was found and cached, false otherwise + */ + protected function cacheAndAppendScssIfExist($root, $file, $webRoot = null) { + if (is_file($root.'/'.$file)) { + $scssCache = new \OC\Template\SCSSCacher( + $this->logger, + $root, + $file); + + if($scssCache->process()) { + $this->append($root, $scssCache->getCachedSCSS(), $webRoot, false); + $this->logger->debug($root.'/'.$file.' compiled and successfully cached', ['app' => 'SCSSPHP']); + return true; + } else { + $this->logger->error('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'SCSSPHP']); + return false; + } + } + return false; + } + + /** * append the $file resource at $root * * @param string $root path to check |