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

Bug: scss/_list.scss throws error on compilation #19078

Closed
1 of 2 tasks
anthonypwinning opened this issue May 27, 2022 · 5 comments
Closed
1 of 2 tasks

Bug: scss/_list.scss throws error on compilation #19078

anthonypwinning opened this issue May 27, 2022 · 5 comments
Labels
bug needs-triage This bug needs to be confirmed waiting for feedback

Comments

@anthonypwinning
Copy link

anthonypwinning commented May 27, 2022

Bug description

When I attempt to compile FontAwsome as a yarn package with Sass, _scss/list.scss appears to be the source of an error that prevents compilation.

I believe:

left: calc(var(--#{$fa-css-prefix}-li-width, #{$fa-li-width}) * -1);

Should be:

left: var(--#{$fa-css-prefix}-li-width, calc(#{$fa-li-width} * -1));

Everything works fine after changing that one line. I'll add a pull request with this code change.

Reproducible test case

No response

Screenshots

No response

Font Awesome version

v6.1.1

Serving

Self-hosted

Implementation

Other (as specified in the bug description)

Browser and Operating System

Chrome Version 101.0.4951.64 (Official Build) (x86_64) on MacOS

Web bug report checklist

  • I have included a test case because my odds go way up that the team can fix this when I do
  • I have searched for existing issues and to the best of my knowledge this is not a duplicate
@anthonypwinning anthonypwinning added bug needs-triage This bug needs to be confirmed labels May 27, 2022
@tagliala
Copy link
Member

Hi!

Thanks for being part of the Font Awesome Community.

I believe:

left: calc(var(--#{$fa-css-prefix}-li-width, #{$fa-li-width}) * -1);

Should be:

left: var(--#{$fa-css-prefix}-li-width, calc(#{$fa-li-width} * -1));

As far as I can see, they are not the same thing

$fa-css-prefix: "fa";
$fa-li-width: 2em;

:root {
    --#{$fa-css-prefix}-li-width: #{$fa-li-width};
}

.before {
    left: calc(var(--#{$fa-css-prefix}-li-width, #{$fa-li-width}) * -1);
}

.after {
    left: var(--#{$fa-css-prefix}-li-width, calc(#{$fa-li-width} * -1));
}

compiles to

:root {
  --fa-li-width: 2em;
}

.before {
  left: calc(var(--fa-li-width, 2em) * -1);
}

.after {
  left: var(--fa-li-width, calc(2em * -1));
}

Demo: https://jsfiddle.net/tagliala/uz7b1wha/3/

Are you using a custom value for $fa-li-width? Could you please provide more details about the error you are getting?

@anthonypwinning
Copy link
Author

Apologies, I think this was a false alarm. I uninstalled and reinstalled the packages via yarn, and everything worked. Thank you for your assistance.

@knoxjeffrey
Copy link

knoxjeffrey commented Aug 2, 2022

Hello @tagliala , I just wanted to raise this issue again as I came across when upgrading to v6.1.2. The source of the issue is the same for me:

left: calc(var(--#{$fa-css-prefix}-li-width, #{$fa-li-width}) * -1);

I've done some digging into this and turns out the issue eventually lies with postcss-values-parser. See this issue shellscape/postcss-values-parser#138. I can confirm that the fix is to swap the order:

left: calc(-1 * var(--#{$fa-css-prefix}-li-width, #{$fa-li-width}));

I'm stuck with an older version of postcss-values-parser because of Webpacker as used with Rails but this change should fix the issue and produce the same intended outcome.

@tagliala
Copy link
Member

tagliala commented Aug 2, 2022

Hi @knoxjeffrey , that issue is tracked at #18899 and it's planned for 6.2.0 release

@knoxjeffrey
Copy link

Amazing @tagliala , thank you so much for proving this workaround! Sorry I didn't spot the issue being tracked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-triage This bug needs to be confirmed waiting for feedback
Projects
None yet
Development

No branches or pull requests

3 participants