Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable every app to generate their scss file #3197

Merged
merged 3 commits into from
Jan 26, 2017

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Jan 22, 2017

With this pr, every app can use the core scss compile&cache system.
You just have to change your css file to a .scss and the server will handle the rest :)

  • Css files will be stored in the appdata inside the "css" folder and with the application key.
    ex: /core/css/styles.scss will be stored under appdata/css/core/styles.css
    or: /settings/css/settings.scss in appdata/css/settings/settings.css
    or: /apps/mail/css/mail.scss in appdata/mail/mail.css

@eppfel, it will be helpful for your new app store design #3194 and #3195 :)

@nextcloud/security Can I have a validation from you? What are the possible outcome from such implementation?

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
$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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) {

instead to make sure things work when using alternative app directories.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', null, $app)) {

to pass the correct app parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did I missed that!
Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, after a quick thought, it seems that we never used the webroot here.
So I'm not sure we need it :p

Copy link
Member

@icewind1991 icewind1991 Jan 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Webroot isn't needed with scss since we load it trough a route anyway, for css it's still needed afaik

edit: ignore this, was talking about different webroot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it.
We had the webroot var, but it wasn't used by anything nor passed through a function.

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@icewind1991
Copy link
Member

@skjnldsv still need to use $app_path to ensure things work with alternate app directories

@skjnldsv
Copy link
Member Author

@icewind1991 what do you mean?

@icewind1991
Copy link
Member

An admin can configure multiple folder that apps can be stored in besides nextcloud/apps, $app_path takes that into account and will always give the folder where the app is located.

nextcloud/apps will only work 99% of the time

@skjnldsv
Copy link
Member Author

Oh nice!
Where can we get this info from? Was it on your pr?

@icewind1991
Copy link
Member

Conveniently we already have the variable 3 lines above it 😄

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv
Copy link
Member Author

@icewind1991 you're amazing !

🚀

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works 👍

@codecov-io
Copy link

Current coverage is 54.08% (diff: 0.00%)

Merging #3197 into master will increase coverage by 0.14%

@@             master      #3197   diff @@
==========================================
  Files          1299       1299          
  Lines         80145      81069   +924   
  Methods        7909       8111   +202   
  Messages          0          0          
  Branches       1248       1248          
==========================================
+ Hits          43228      43845   +617   
- Misses        36917      37224   +307   
  Partials          0          0          
Diff Coverage File Path
0% lib/private/Template/CSSResourceLocator.php
0% lib/private/Template/SCSSCacher.php

Powered by Codecov. Last update 0d6e3ca...dcad603

@MorrisJobke MorrisJobke merged commit e7523b0 into master Jan 26, 2017
@MorrisJobke MorrisJobke deleted the enable-scss-for-all-apps branch January 26, 2017 04:53
@skjnldsv
Copy link
Member Author

I would have loved a little feedback from @nextcloud/security .
Maybe it introduces some flaws? :/

@skjnldsv skjnldsv mentioned this pull request Feb 18, 2017
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants