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

SASS compiler fails to compile rgba(#xxx, yy) value with php 7.4 #5058

Closed
TimFoerster opened this issue Apr 30, 2020 · 22 comments
Closed

SASS compiler fails to compile rgba(#xxx, yy) value with php 7.4 #5058

TimFoerster opened this issue Apr 30, 2020 · 22 comments

Comments

@TimFoerster
Copy link
Contributor

TimFoerster commented Apr 30, 2020

  • OctoberCMS Build: dev-master
  • PHP Version: 7.4

Description:

SASS file with

#header {
   background-color: rgba(#333, 0.99);
}

should compile with php 7.4, but fails

related to leafo/scssphp#710

waiting for https://github.com/assetic-php/assetic/tree/2.0/dev migration?

@TimFoerster TimFoerster changed the title SASS compiler fails to compile rgba(#xxx, yy) with php 7.4 SASS compiler fails to compile rgba(#xxx, yy) value with php 7.4 Apr 30, 2020
@LukeTowers
Copy link
Contributor

@TimFoerster please try switching to the Laravel 6 branch and let us know if it's still a problem there.

@github-actions
Copy link

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days.
If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.
If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

@XIOLog
Copy link

XIOLog commented Jul 1, 2020

I have some problem

@XIOLog
Copy link

XIOLog commented Jul 1, 2020

I have switched to the Laravel 6 branch and a problem still remains

  • OctoberCMS Build: master
  • PHP Version: 7.4
  • Database Engine: MariaDB

Description:

SASS file with

&__overlay {
    background-color: rgba($link, 0.95);
}

I had an error:

/* Trying to access array offset on value of type null */

I have switched to the Laravel 6 branch (wip/laravel-6), but the problem still remains.

@LukeTowers LukeTowers reopened this Jul 1, 2020
@LukeTowers LukeTowers added this to the v1.0.468 milestone Jul 1, 2020
@bennothommo bennothommo modified the milestones: v1.0.468, v1.0.469 Jul 29, 2020
@LukeTowers LukeTowers modified the milestones: v1.1.0, v1.1.1 Sep 4, 2020
@rwcorbett
Copy link

for what it's worth it seems to be only that particular CSS function not compiling... I tested these:

$red1: #ff0000;
$red2: #ff00007c;
.journeyChoosePathBtns  {
    button {
        // background: red !important;                  // WORKS
        // background: $red1 !important;                // WORKS
        // background: $red2 !important;                // WORKS
        // background: rgba(200,0,0,0.9) !important;    // WORKS
        // background: rgb(200,0,0) !important;         // WORKS
        // background: rgba(#ff0000,0.9) !important;    // does not compile
        // background: rgba(#f00,0.9) !important;       // does not compile
        // background: rgba($red1,0.9) !important;      // does not compile
    }
}

@LukeTowers
Copy link
Contributor

@jaxwilko if you're feeling bored maybe you could take a look at this?

@jaxwilko
Copy link

@rwcorbett when I add your code to a file then include it with:

<link href="{{ ['assets/scss/test.scss']|theme }}" rel="stylesheet">

The output is:

.journeyChoosePathBtns button {
  background: red !important;
  background: #ff0000 !important;
  background: #ff00007c !important;
  background: rgba(200, 0, 0, 0.9) !important;
  background: #c80000 !important;
  background: rgba(255, 0, 0, 0.9) !important;
  background: rgba(255, 0, 0, 0.9) !important;
  background: rgba(255, 0, 0, 0.9) !important; }

In both php7.3 & php7.4

Could you give me a pointer in how to replicate the issue?

@rwcorbett
Copy link

rwcorbett commented Oct 7, 2020

Okay let me clarify - we were using this method of calling the stylesheet:

<?php
function onStart() {
    $this->addCss(['assets/scss/test.scss']);
}
?>

Also please note the specific syntax of the SASS rgba function being called rgba( $color, $alpha); (see HERE for reference).

This is the format that does not work:

.journeyChoosePathBtns  {
    button {
        background: rgba(#ff0000,0.9) !important;
    }
}

test.scss ==> test.zip

In your code you are using the 4 param rgba functions. However, when there are only 2 params being passed and something is not parsing that syntax.

Is this due to the SASS lib being used? 'Dart Sass' vs 'LibSass' vs 'Ruby Sass'?

@mjauvin
Copy link
Contributor

mjauvin commented Oct 20, 2020

@rwcorbett the way I read what @jaxwilko said was that the RESULTING css once compiled was converted to rgba(r, g, b, a), but he used rgba(#rgb, a) in the source scss file.

@mjauvin
Copy link
Contributor

mjauvin commented Oct 20, 2020

@rwcorbett For reference, I also tested this on 1.1 branch (Laravel 6) using the following:

file assets/scss/test.css:

$red1: #ff0000;
$red2: #ff00007c;

.journeyChoosePathBtns  {
    button {
        background: red !important;
        background: $red1 !important;
        background: $red2 !important;
        background: rgba(200,0,0,0.9) !important;
        background: rgb(200,0,0) !important;
        background: rgba(#ff0000,0.9) !important;
        background: rgba(#f00,0.9) !important;
        background: rgba($red1,0.9) !important;
    }
}

I included this in my layout like below:

<link rel="stylesheet" href="{{ ['assets/scss/test.scss'] | theme }}">

And in my broswer debug tool, I see the following:

Screenshot from 2020-10-20 11-43-11

@mjauvin
Copy link
Contributor

mjauvin commented Oct 20, 2020

I also tested including the asset in the page's code section like below, and the result is the same as above:

==
<?php
function onStart() {
    $this->addCss(['assets/scss/test.scss']);
}
?>
==

@mjauvin
Copy link
Contributor

mjauvin commented Oct 20, 2020

Just tested on branch 1.0 (Laravel 5.5) and it works the same...

@LukeTowers
Copy link
Contributor

Closing unless someone can provide detailed reproduction instructions.

@rwcorbett
Copy link

Thanks @LukeTowers & @mjauvin et al... it is definitely not 'mission critical' enough to explore further debugging, I think for sure close this. It might just be a PEBKAC error - I have only been using Laravel/OctCMS for ~ 6 months.

@TimFoerster
Copy link
Contributor Author

I think this was fixed here: scssphp/scssphp@033accd

@mediaclinic
Copy link
Contributor

I think the problem is in this old project: leafo/scssphp. When I updated the Compiler.php with given Gauntry version, everything worked like a charm.

This problem with SCSS-compile came with php7.4 but does not exists with lower versions. Would it be a good choice to change this functionality to work with different solution? What do you think @LukeTowers, @mjauvin?

@mjauvin
Copy link
Contributor

mjauvin commented Dec 8, 2020

There are other problems with the asset compiler on branch 1.0 using php 7.4,not sure if they're all related to this problem. If so, then it might be worth fixing, otherwise I suggest updating to the 1.1 branch where the problem does not exist.

@LukeTowers
Copy link
Contributor

@mediaclinic we're not going to do anything about it on 1.0. AFAIK it's fixed on 1.1, so use that instead. If there are problems on 1.1 then create a new issue with those details please.

@DigiGNOSIS
Copy link

@LukeTowers does this mean this fix / new asset compiler will be included in a future October CMS update? (still having this problem with .scss files on build 471 with PHP7.4)

@LukeTowers
Copy link
Contributor

@DigiGNOSIS it's already present in the latest version of October. The marketplace is being worked on to deliver 1.1 updates, but until then you can use composer.

@mrelliot69
Copy link

still having this issue, any updates on how to solve it?

@daftspunk
Copy link
Member

Hi @mrelliot69

This was fixed long ago. Make sure you are using the latest version. If you need help with October CMS, please contact the helpdesk: https://octobercms.com/contact

@octobercms octobercms locked as resolved and limited conversation to collaborators Oct 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests