twbs / bootstrap-sass

Official Sass port of Bootstrap 2 and 3.
http://getbootstrap.com/css/#sass
MIT License
12.59k stars 3.53k forks source link

math.div changes applied to non-division variables #1224

Closed tzappia closed 2 years ago

tzappia commented 2 years ago

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 2 years ago

Pushed v3.4.3 with the fix (https://github.com/twbs/bootstrap-sass/pull/1225)

mockdeep commented 2 years ago

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;
glebm commented 2 years ago

/cc @AprilArcus

AprilArcus commented 2 years ago

Looking

AprilArcus commented 2 years ago

@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.

mockdeep commented 2 years ago

Okay, thanks, will do.