question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bootstrap 4.5.0 SASS error

See original GitHub issue

We’re using Bootstrap 4.5.0 in our SASS project.

We have this sass file:

@import "~bootstrap/scss/bootstrap-grid";
@import "~bootstrap/scss/bootstrap-reboot";
@import "~bootstrap/scss/alert";
@import "~bootstrap/scss/buttons";
@import "~bootstrap/scss/forms";
@import "~bootstrap/scss/nav";
@import "~bootstrap/scss/navbar";
@import "~bootstrap/scss/dropdown";
@import "~bootstrap/scss/utilities/text";
@import "~bootstrap/scss/type";

When we try to compile this, we get this error:

ERROR in node_modules/bootstrap/scss/_root.scss:5:1 Please check validity of the block starting from line #5 [Fatal]

It appears that this piece of code is throwing the error:

@each $color, $value in $colors {
    --#{$color}: #{$value};
  }

We’re using the Dart implementation for SASS, version 1.26.10.

I was unable to create a reproducible example because I keep getting other errors. Please advise.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tordanscommented, Aug 11, 2021

Sounds like an issue in the linter or Sass compiler? If so, perhaps we close this out?

@mdo the issue is still present in Bootstrap 4.5 ATM, the linked ticket on sass-linkt is from 2017 and I cannot see any relevant action since then https://github.com/sasstools/sass-lint/issues/1114#issuecomment-544216592.

This ticket is a year old now.

I think it would be good to find a solution in Bootstrap (4) and not wait any longer for upstream changes. Could you reopen the ticket? And do you have a preferred way of solving this?

1reaction
jordyvandomselaarcommented, Jul 29, 2020

After searching around more, I found this comment.

When I change

// Do not forget to update getting-started/theming.md!
:root {
  // Custom variable values only support SassScript inside `#{}`.
  @each $color, $value in $colors {
    --#{$color}: #{$value};
  }

  @each $color, $value in $theme-colors {
    --#{$color}: #{$value};
  }

  @each $bp, $value in $grid-breakpoints {
    --breakpoint-#{$bp}: #{$value};
  }

  // Use `inspect` for lists so that quoted items keep the quotes.
  // See https://github.com/sass/sass/issues/2383#issuecomment-336349172
  --font-family-sans-serif: #{inspect($font-family-sans-serif)};
  --font-family-monospace: #{inspect($font-family-monospace)};
}

to

// Do not forget to update getting-started/theming.md!
:root {
  // Custom variable values only support SassScript inside `#{}`.
  @each $color, $value in $colors {
      #{--#{$color}}: #{$value};
  }

  @each $color, $value in $theme-colors {
      #{--#{$color}}: #{$value};
  }

  @each $bp, $value in $grid-breakpoints {
    #{--breakpoint-#{$bp}}: #{$value};
  }

  // Use `inspect` for lists so that quoted items keep the quotes.
  // See https://github.com/sass/sass/issues/2383#issuecomment-336349172
  --font-family-sans-serif: #{inspect($font-family-sans-serif)};
  --font-family-monospace: #{inspect($font-family-monospace)};
}

it compiles successfully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap 4.5 scss compilation error on escapeSVG
Now when I compile the app (we compile from Bootstrap's SCSS imported into our own to override variables) it fails with this error:...
Read more >
Bootstrap 4.5.0
Quickly set user-select with the new utilities and Sass map. New Reboot style for pointer cursors. We now include a role="button" selector in ......
Read more >
Theming Bootstrap · Bootstrap v4.5
As you customize the included maps, you may encounter errors where a specific Sass map's key is being used. For example, we use...
Read more >
Sass · Bootstrap v5.0
Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project....
Read more >
Introduction · Bootstrap v4.5
Get started with Bootstrap, the world's most popular framework for building responsive, mobile-first sites, with jsDelivr and a template starter page.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found