summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-01-25 22:53:23 -0600
committerGitHub <noreply@github.com>2017-01-25 22:53:23 -0600
commite7523b07bd9d17de22248c4993eb9c7a2eda2827 (patch)
tree30feb87a8337e95f0582f5c996202a9200346562
parentfeab1e5b947fa269eebbfd6219f733a5bfa52193 (diff)
parentdcad6032b1c476572dd4404b5aede440e119d53f (diff)
downloadnextcloud-server-e7523b07bd9d17de22248c4993eb9c7a2eda2827.tar.gz
nextcloud-server-e7523b07bd9d17de22248c4993eb9c7a2eda2827.zip
Merge pull request #3197 from nextcloud/enable-scss-for-all-apps
Enable every app to generate their scss file
-rw-r--r--lib/private/Template/CSSResourceLocator.php15
-rw-r--r--lib/private/Template/SCSSCacher.php7
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php
index 6af4e319e36..b306e078cd2 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($app_path, $style.'.scss', $app)) {
+ $this->append($app_path, $style.'.css', $app_url);
+ }
}
/**
@@ -80,14 +82,13 @@ class CSSResourceLocator extends ResourceLocator {
*
* @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) {
+ protected function cacheAndAppendScssIfExist($root, $file, $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), false);
return true;
} else {
$this->logger->error('Failed to compile and/or save '.$root.'/'.$file, ['app' => 'core']);
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index 0c1711b9fb7..d6f5a2c6fd3 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -63,9 +63,10 @@ class SCSSCacher {
* Process the caching process if needed
* @param string $root Root path to the nextcloud installation
* @param string $file
+ * @param string $app The app name
* @return boolean
*/
- public function process($root, $file) {
+ public function process($root, $file, $app) {
$path = explode('/', $root . '/' . $file);
$fileNameSCSS = array_pop($path);
@@ -78,10 +79,10 @@ class SCSSCacher {
$webDir = implode('/', $webDir);
try {
- $folder = $this->appData->getFolder('core');
+ $folder = $this->appData->getFolder($app);
} catch(NotFoundException $e) {
// creating css appdata folder
- $folder = $this->appData->newFolder('core');
+ $folder = $this->appData->newFolder($app);
}
if($this->isCached($fileNameCSS, $fileNameSCSS, $folder, $path)) {