The path to a css file generated from an scss source file for a third-party app is not correct for my testing installation. I renamed the css file of the Tasks app to style.scss. The css file is generated automatically just fine under <ncwebroot>/data/appdata_***/css/tasks/style.css but including it using style('tasks', 'style'); does not work.
The path to the generated css file should read index.php/data/appdata_***/css/tasks/style.css
The path reads index.php/css/tasks/style.css and the generated css file cannot be found.
This happens under current nextcloud master.
The path reads index.php/css/tasks/style.css and the generated css file cannot be found.
This path should be correct. We only store the result in the app data folder. Serving from this folder is forbidden anyway and that is the reason why it should not be reflected in the path.
@skjnldsv Can you give a hint anyway?
Yep, this should be. Any error in the nextcloud log?
Tried it right now, can't reproduce. Your scss is maybe invalid.
but including it using style('tasks', 'style'); does not work.
@raimund-schluessler This is the correct way and should work. What is the response in the web developer tools for this element?
Serving from this folder is forbidden anyway and that is the reason why it should not be reflected in the path.
Ok, didn't knew that.
Your scss is maybe invalid.
I just renamed the css file, which should be valid scss code. Also the css file is generated correctly
The server answers with this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.php/css/tasks/style.css was not found on this server.</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at 192.168.56.2 Port 80</address>
</body></html>
The nextcloud log says:
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"PHP","message":"Undefined index: \/var\/www\/nextcloud\/apps\/tasks at \/var\/www\/nextcloud\/lib\/private\/Template\/ResourceLocator.php#120","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"tasks","message":"Could not find resource file \"\/index.php\/css\/tasks\/style.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
I also see this for other files, but without the "Undefined index" error
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/styles.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/header.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/icons.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/apps.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/multiselect.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/tooltip.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"core","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/share.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"mgMzAj0vy0Io8G9RLVSh","remoteAddr":"192.168.56.1","app":"css","message":"Could not find resource file \"\/nextcloud\/index.php\/css\/core\/inputs.css\"","level":0,"time":"2017-02-24T07:06:50+00:00","method":"GET","url":"\/nextcloud\/index.php\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
Just tried with tasks and worked fine ^^

Well, there has to be a reason why it doesn't work for my testing installation.
Ahaha, It sure should be! @MorrisJobke can you try renaming the task css to scss?
And see if it loads :)
@raimund-schluessler to check your sass file: http://www.sassmeister.com/
Ahaha, It sure should be! @MorrisJobke can you try renaming the task css to scss?
And see if it loads :)
Also doesn't work here. Let me debug this one.
{"reqId":"TOerWQ3nFnQvVnN6FrLJ","remoteAddr":"192.168.99.1","app":"PHP","message":"Undefined index: \/srv\/projects\/server\/apps2\/tasks at \/srv\/projects\/server\/lib\/private\/Template\/ResourceLocator.php#120","level":3,"time":"2017-02-24T17:12:50+00:00","method":"GET","url":"\/server\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
{"reqId":"TOerWQ3nFnQvVnN6FrLJ","remoteAddr":"192.168.99.1","app":"tasks","message":"Could not find resource file \"\/css\/tasks\/style.css\"","level":0,"time":"2017-02-24T17:12:50+00:00","method":"GET","url":"\/server\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
I really suspect in those lines the problem.
I really suspect in those lines the problem.
I guess it's because the app is in apps2 and not in apps. Let me check.
For my installation its in apps.
Are you using url rewritting?
Are you using url rewritting?
Yes: http://192.168.99.100/server/apps/tasks/#/collections/all
And @raimund-schluessler ?
It is not in the mapping variable:

Are you using url rewritting?
Not that I knew of.
@skjnldsv Can I ask you to have a look. I'm not that familiar with the whole SCSS process, but it looks like it needs some refinement here:

@skjnldsv And the tasks app needs to look like this:

And not like this:

I'll look later this week-end if you don't mind. Busy tonight :)
The reason really seems to be this error:
{"reqId":"TOerWQ3nFnQvVnN6FrLJ","remoteAddr":"192.168.99.1","app":"PHP","message":"Undefined index: \/srv\/projects\/server\/apps2\/tasks at \/srv\/projects\/server\/lib\/private\/Template\/ResourceLocator.php#120","level":3,"time":"2017-02-24T17:12:50+00:00","method":"GET","url":"\/server\/apps\/tasks\/","user":"admin","version":"12.0.0.13"}
When I hardcode $webroot to 'http://192.168.56.2/nextcloud' at https://github.com/nextcloud/server/blob/3d8a300b77f2c9a5ba4a899b81ae3ab3883097eb/lib/private/Template/ResourceLocator.php#L120 then the compiled css file loads correctly (altough the sprites file is not loaded anymore).
diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php
index e22ebdc..65ca1be 100755
--- a/lib/private/Template/ResourceLocator.php
+++ b/lib/private/Template/ResourceLocator.php
@@ -117,7 +117,38 @@ abstract class ResourceLocator {
*/
protected function append($root, $file, $webRoot = null, $throw = true) {
if (!$webRoot) {
- $webRoot = $this->mapping[$root];
+ $webRoot = '';
+ $tmpRoot = $root;
+ /*
+ * traverse the potential web roots upwards in the path
+ *
+ * example:
+ * - root: /srv/www/apps/myapp
+ * - available mappings: ['/srv/www']
+ *
+ * First we check if a mapping for /srv/www/apps/myapp is available,
+ * then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a
+ * valid web root
+ */
+ do {
+ if (isset($this->mapping[$tmpRoot])) {
+ $webRoot = $this->mapping[$tmpRoot];
+ break;
+ }
+ $newRoot = dirname($tmpRoot);
+ if ($newRoot === $tmpRoot) {
+ $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [
+ 'app' => 'lib',
+ 'root' => $root,
+ 'file' => $file,
+ 'webRoot' => $webRoot,
+ 'throw' => $throw ? 'true' : 'false'
+ ]);
+ break;
+ }
+ $tmpRoot = $newRoot;
+ } while(true);
+
}
$this->resources[] = array($root, $webRoot, $file);
This patch works for me.
Fix is in #3619
Referencing images in the sprites file seems to ge a general problem. The location of the compiled css file is different to the original scss file. Hence, the relative paths cannot work anymore. What would be the solution? Copy the referenced images to the appdata folder? Reference images in a css file which does not have to be compiled? Give a path to the appdata folder in the scss file?
@raimund-schluessler it's because of the rebaseUrls function in SCSSCacher.php. It needs an update to calculate the diff between root and the css location.
it's because of the rebaseUrls function in SCSSCacher.php. It needs an update to calculate the diff between root and the css location.
Should I create a separate issue for that?
Let's fix it in #3619 too
Let's fix it in #3619 too
@skjnldsv Could you help me there, please?
@skjnldsv ping :smile:
Don't have time, sry!.
You need a function that calculate the number of ../ necessary to add before applying the correct path.
So you need to calculate the correct difference between the url provided by the css and the real relative path.
Fixed with #3619
Most helpful comment
Also doesn't work here. Let me debug this one.