twbs/bootstrap-sass

math.div changes applied to non-division variables

tzappia opened this issue · 6 comments

assets/stylesheets/bootstrap/_variables.scss and templates/project/_bootstrap-variables.sass have had some lines converted to math.div, but the original variables were not division (or were in comments.) Examples:

$container-desktop: (940px + $grid-gutter-width) !default;
is now
$container-desktop: math.div(940px + $grid-gutter-width) !default;

// Small screen / tablet
is now
// Small screen, tablet

This causes a sass error (sass@1.47.0)

Message:
    node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss
Error: Missing argument $number2.
  ┌──> node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_variables.scss
338│ $grid-float-breakpoint-max: math.div($grid-float-breakpoint - 1) !default;
  │                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation
glebm commented

Pushed v3.4.3 with the fix (#1225)

We're still seeing something like this on v3.4.3:

SassC::SyntaxError: Error: Invalid CSS after "  margin: (math": expected expression (e.g. 1px, bold), was ".div($line-height-c"
        on line 8:16 of node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins/_nav-divider.scss
        from line 25:1 of node_modules/bootstrap-sass/assets/stylesheets/bootstrap/_mixins.scss
        from line 7:1 of app/assets/stylesheets/legacy/variables/_manifest.scss
        from line 1:1 of app/assets/stylesheets/admin.scss
>>   margin: (math.div($line-height-computed, 2) - 1) 0;

Looking

@mockdeep This error appears to be due to the use of SassC instead of dart-sass. SassC wraps libsass, which does not support the math.div syntax. SassC and libsass are deprecated.

If compatibility with SassC and libsass are necessary, I recommend you remain on 3.4.1. Otherwise, I recommend you upgrade your sass compiler to an appropriate version of dart-sass (i.e. "sass": "^1.33") for future-proofing.

Okay, thanks, will do.