summaryrefslogtreecommitdiffstats
path: root/lib/private/Template/CSSResourceLocator.php
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-01-22 19:33:45 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-01-22 19:33:45 +0100
commit4ceb2bf84ce4c40345feae3846a0f5aae926ce1f (patch)
treefa0765aa3389223059eabcf55718b80af102ecb0 /lib/private/Template/CSSResourceLocator.php
parent0d6e3ca86b28fcf87a2541b97e1984a7a36c8bc6 (diff)
downloadnextcloud-server-4ceb2bf84ce4c40345feae3846a0f5aae926ce1f.tar.gz
nextcloud-server-4ceb2bf84ce4c40345feae3846a0f5aae926ce1f.zip
Enable every app to generate their scss file
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/Template/CSSResourceLocator.php')
-rw-r--r--lib/private/Template/CSSResourceLocator.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php
index 6af4e319e36..bcc43198cbb 100644
--- a/lib/private/Template/CSSResourceLocator.php
+++ b/lib/private/Template/CSSResourceLocator.php
@@ -49,20 +49,22 @@ class CSSResourceLocator extends ResourceLocator {
* @param string $style
*/
public function doFind($style) {
+ $app = substr($style, 0, strpos($style, '/'));
if (strpos($style, '3rdparty') === 0
&& $this->appendIfExist($this->thirdpartyroot, $style.'.css')
- || $this->cacheAndAppendScssIfExist($this->serverroot, $style.'.scss')
+ || $this->cacheAndAppendScssIfExist($this->serverroot, $style.'.scss', $app)
|| $this->cacheAndAppendScssIfExist($this->serverroot, 'core/'.$style.'.scss')
|| $this->appendIfExist($this->serverroot, $style.'.css')
|| $this->appendIfExist($this->serverroot, 'core/'.$style.'.css')
) {
return;
}
- $app = substr($style, 0, strpos($style, '/'));
$style = substr($style, strpos($style, '/')+1);
$app_path = \OC_App::getAppPath($app);
$app_url = \OC_App::getAppWebPath($app);
- $this->append($app_path, $style.'.css', $app_url);
+ if(!$this->cacheAndAppendScssIfExist($this->serverroot.'/apps', $app.'/'.$style.'.scss', $app)) {
+ $this->append($app_path, $style.'.css', $app_url);
+ }
}
/**
@@ -83,11 +85,11 @@ class CSSResourceLocator extends ResourceLocator {
* @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) {
+ protected function cacheAndAppendScssIfExist($root, $file, $webRoot = null, $app = 'core') {
if (is_file($root.'/'.$file)) {
if($this->scssCacher !== null) {
- if($this->scssCacher->process($root, $file)) {
- $this->append($root, $this->scssCacher->getCachedSCSS('core', $file), $webRoot, false);
+ if($this->scssCacher->process($root, $file, $app)) {
+ $this->append($root, $this->scssCacher->getCachedSCSS($app, $file), $webRoot, false);
return true;
} else {
$this->logger->error('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'core']);