-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Handle Sass 1.33 and math.div #1221
Conversation
@glebm Any idea when this PR might get brought in? Very much an issue. |
@AprilArcus This gem has a runtime dependency on |
@cutterbl If it's an issue for you, thank @AprilArcus and use their branch for now 😐 |
I wasn't aware that this package produces a Ruby gem as well as a node module. If support for the Ruby gem is a hard requirement in order to merge, then we may be blocked. https://sass-lang.com/ruby-sass states that "sassc gem is the most seamless way to move away from Ruby Sass", but sassc's own README.md states that both it and the libsass library which it wraps are deprecated. Are you aware of any ruby gems which wrap dart-sass? I found this relevant conversation at rubyonrails.org, but I confess that I've been out of the Ruby ecosystem for many years and I'm not even sure what criteria users of this gem would use to judge an ideal upgrade path. |
@@ -136,7 +137,7 @@ mark, | |||
// ------------------------- | |||
|
|||
.page-header { | |||
padding-bottom: (($line-height-computed / 2) - 1); | |||
padding-bottom: math.div(($line-height-computed, 2) - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be padding-bottom: (math.div($line-height-computed, 2) - 1);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, christmas. I suppose I will need to write a proper parser after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AprilArcus Any plans to make the two fixes outlined by @aEvgenn ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at kikyous/bootstrap3-sass
. Suitable for a temporary solution. There will be only one trouble - replacing the package name in the paths bootstrap-sass
-> bootstrap3-sass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AprilArcus Any plans to make the two fixes outlined by @aEvgenn ?
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
// Horizontal dividers | ||
// | ||
// Dividers (basically an hr) within dropdowns and nav lists | ||
|
||
@mixin nav-divider($color: #e5e5e5) { | ||
height: 1px; | ||
margin: (($line-height-computed / 2) - 1) 0; | ||
margin: math.div(($line-height-computed, 2) - 1) 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be margin: (math.div($line-height-computed, 2) - 1) 0;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'd love to see this merged and released, @glebm 🙏
still need to address some bugs noted upthread |
a141517
to
a9f3b35
Compare
0b7b7c2
to
dd38faa
Compare
The ruby gem is still an issue, because |
I understand that, but as you know short of writing a novel Gem to wrap dart-sass, there is nothing we can do for users of the Ruby gem here. That fact notwithstanding, this work has value to developers in the NPM ecosystem. Can we publish this to NPM without updating the Gem? |
Yeah, we probably could do this from a separate branch. I'll have a look. |
Published 3.4.2 to npm only |
@@ -334,24 +335,24 @@ $grid-gutter-width: 30px !default; | |||
//** Point at which the navbar becomes uncollapsed. | |||
$grid-float-breakpoint: $screen-sm-min !default; | |||
//** Point at which the navbar begins collapsing. | |||
$grid-float-breakpoint-max: ($grid-float-breakpoint - 1) !default; | |||
$grid-float-breakpoint-max: math.div($grid-float-breakpoint - 1) !default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct?
I'm getting this error
(same thing @ line 351)
SassError: 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
╵
┌──> sass:math
1 │ @function div($number1, $number2) {
│ ━━━━━━━━━━━━━━━━━━━━━━━ declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep looks wrong. @AprilArcus Can you please fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will address this right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR: #1225
$navbar-padding-horizontal: floor(($grid-gutter-width / 2)) !default; | ||
$navbar-padding-vertical: (($navbar-height - $line-height-computed) / 2) !default; | ||
$navbar-padding-horizontal: floor(math.div($grid-gutter-width, 2)) !default; | ||
$navbar-padding-vertical: (math.div($navbar-height - $line-height-computed), 2) !default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$navbar-padding-vertical: (math.div($navbar-height - $line-height-computed), 2) !default; | |
$navbar-padding-vertical: math.div(($navbar-height - $line-height-computed), 2) !default; |
// Navbar vertical align | ||
// | ||
// Vertically center elements in the navbar. | ||
// Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. | ||
|
||
@mixin navbar-vertical-align($element-height) { | ||
margin-top: (($navbar-height - $element-height) / 2); | ||
margin-bottom: (($navbar-height - $element-height) / 2); | ||
margin-top: (math.div($navbar-height - $element-height), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
margin-top: (math.div($navbar-height - $element-height), 2); | |
margin-top: math.div(($navbar-height - $element-height), 2); | |
margin-bottom: math.div(($navbar-height - $element-height), 2); |
It's a good practice to lock dependency versions. But there's a specific reason why this needs to be done now. Tunnistamo isn't compatible with bootstrap-sass version 3.4.2. That version switches [1] to a newish Sass syntax that isn't backwards compatible [2]. Tunnistamo uses the django-sass-processor package to do Sass preprocessing. That package uses the libsass library, which is deprecated and will never support any newer Sass syntax [3]. As a result, Tunnistamo is stuck with an old Sass syntax version unless the preprocessor system is changed to something more modern. In this commit the bootstrap-sass is locked to version 3.4.1 which still uses the older syntax that libsass supports. [1] twbs/bootstrap-sass#1221 [2] https://sass-lang.com/documentation/breaking-changes/slash-div [3] https://sass-lang.com/blog/libsass-is-deprecated
I am getting this error when using bootstrap-sass in angular application. This started happening right after the division fix was applied. `Module build failed (from ./node_modules/sass-loader/lib/loader.js): $navbar-padding-horizontal: floor(math.div($grid-gutter-width, 2)) !default; How can this be resolved? |
@ashimg Make sure you are using sass-loader 7.1.0 or later. Be sure that dart-sass (that is, the npm package called |
Thank you @AprilArcus. For angular 8+, in order to use the sass-loader (dart-sass) you mentioned, is it necessary to have webpack? The way I am understanding the instructions, it assumes webpack. |
Yes,
It sounds like you aren't sure if you are in fact using Webpack. It may be the case that you are using a higher-level tool that wraps Webpack, such as Create React App or Next.js. If you tell me more about your build system, I can help you figure out how to configure it. |
@AprilArcus , yes you are correct. I was not sure about it as I did not find a webpack.config.js file in the angular project I am working with. I found out that it is wrapped within There is a package.json file specifying the Full error: |
It looks like dart-sass was added to If we zero in on the area where the sass implementation is actually selected in your version of
we can see that it will first try to find I suggest running Alternatively, if you are able to upgrade |
Hi @AprilArcus , it seems a bit odd since I have the Is the |
try |
|
Okay. It looks like your setup is correctly choosing dart-sass over node-sass, but the version is too low. Try adding |
@AprilArcus it seems it still installs the lower version as part of
|
If you are able to upgrade to it, version 12.13 of If not, and if you have Yarn or a recent version of NPM you can force your current version of for NPM ≥ 8.3.0, see https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides. Note that NPM 8.3.0 first shipped with NodeJS 17.3.0, which is very recent.
for Yarn, see https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/ (Yarn 1.x) or https://yarnpkg.com/configuration/manifest#resolutions (Yarn 2.x)
If you have neither NPM ≥ 8.3.0 nor Yarn available, you could consider using the package https://github.com/rogeriochaves/npm-force-resolutions instead. |
I'm getting this error while compiling scss with ruby sass 3.7.4, this happened when i tried to run "sass app.scss app.css"
_variables.scss:338 |
@vinhspm you should stick with Version 3.4.1 if you are compiling with Ruby Sass. |
yeah thank you i used that version and it worked |
Since sass 1.33.0, the
/
operator is no longer supported. Instead, the newmath.div()
function must be imported via@use "sass:math";
.Many projects lack the resources to upgrade from Bootstrap 3.x, but nevertheless must maintain compatibility with current versions of the sass compiler in order to support other sass dependencies which are tracking the sass compiler's current feature set.
This PR introduces logic to convert the LESS
/
operator to the new sassmath.div()
notation. The usual perils of attempting to parse a parenthesis language with with regular expressions notwithstanding, this code appears to be sufficiently robust to serve future needs.