FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.54k stars 12.2k forks source link

SCSS for FA6 beta 2 incompatible with Bootstrap 4.6.1 due to divide function #18408

Closed richardlawley closed 2 years ago

richardlawley commented 2 years ago

Describe the bug When including FA6 beta 2 in the same project with Bootstrap 4.6.1, Bootstrap gets invalid units in a lot of places. This is because FA has borrowed an implementation of the SCSS divide function from Bootstrap (_functions.scss, contains the comment Originally obtained from the Bootstrap https://github.com/twbs/bootstrap), but they've updated theirs. If FA is included after BS, then FA's implementation is used. This results in sizes in the compiled CSS such as:

font-size: 1remrem;    // Note remrem, not rem

I can work around this by including FA before BS in my app's main scss file, but this is likely to have caused some issues in FA somewhere. I suggest either updating to use the same definition, or renaming the function so you don't collide with Bootstrap's implementation.

To Reproduce In a project with bootstrap 4.6.1 and FA 6 beta 2...

@import "bootstrap/scss/vendor/_rfs";
@import "font-awesome-6/scss/functions";

$font-size-base: 1rem;

.test {
    @include font-size($font-size-base);
}

When compiling, bottom of CSS will end with:

.test { font-size: 1remrem; }

Expected behavior Including FA should not break bootstrap.

Version and implementation Version: Font Awesome 6 beta 2, Bootstrap 4.6.1, Dart SASS 1.43.4

Bug report checklist

tagliala commented 2 years ago

Hi!

Thanks for being part of the Font Awesome Community and thanks for reporting this.

@robmadole I would go for a custom name

robmadole commented 2 years ago

Goodness. Yeah, agreed @tagliala we'll just prefix it with fa probably. This situation is ridiculous.

We'll get it fixed @richardlawley thank you!

robmadole commented 2 years ago

@richardlawley got this fixed in 6.0.0-beta3. If you have a chance can you check it out?

richardlawley commented 2 years ago

Looks good, I can now build again with no warnings with FA6 & BS4.6.1.

Thanks

robmadole commented 2 years ago

@richardlawley thank you!