Firstly, I want to thank you for such an awesome module integration.

I have some scss that follows a pattern which causes the interpolation to fail:

$theme: 'theme';
$font: san-serif;
a {
  font: var(--#{$theme}-font, $font);
}

Which produces:

a {
  font: var(-- theme-fontsan-serif);
}

When it should be producing:

a {
  font: var(--theme-font, sans-serif);
}

I'm currently looking at the code to see if I can figure out a solution, but given the complex nature of the compiler, I'd rather somebody who understands this to respond.

Comments

rhys created an issue. See original summary.

rhys’s picture

StatusFileSize
new1.09 KB

I've attached a patch that fixes the specific problem, but I'm unsure if this is the correct way to approach the solution.

rhys’s picture

StatusFileSize
new1.31 KB

This adds one other small fix, so the spacing is correct.

rhys’s picture

Status: Active » Needs review

I'm fairly confident that this covers my particular use case, but I'd like some feedback on it.

seonic’s picture

Assigned: Unassigned » seonic

It's a scssphp compiler error, I've checked last version of phpscss, and this error still exists, better create issue on github project page (https://github.com/scssphp/scssphp) instead of fixing it in drupal module, scssphp under active development. Compiler.php in module practically same as Compiler.php in scssphp with few modifications. It modify url function to compile path to static resources relative to theme/module, it could be implemented via regex on compiled css, but i think it's not effective, better to modify function which compile path.
On this weekend i will update compileValue function in module, to last version, now it has some difference from scssphp, but in last version error still exists and check scssphp dev branch, and if error will still exists i'll create issue on github page. Or you can if you have time, especially since you already have a solution to this problem :)

rhys’s picture

I'm not sure how to differentiate which code is specifically yours, and which is from scssphp. I'll wait until after you do an update, then try to figure out from there what changes make the most sense.

seonic’s picture

Status: Needs review » Fixed

Changed this ugly decision of copy paste parent class by parent::compileValue(); Now it will always be in actual state, you still can modify logic before parent::compileValue() call.
What about your problem, i have opened issue with bug example, https://github.com/scssphp/scssphp/issues/40
Bug confirmed and workaround added, until the error fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.