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.

Prevent `null` Sass variables from creating empty CSS variables

See original GitHub issue

Prerequisites

Describe the issue

I’m trying to compile bootstrap’s scss without any changes. It compiles fine, but produces broken css with 15 absent values. For example this: --bs-heading-color: ; at line 71

Compiling with Dart-Sass 1.52.3

Actually, already compiled css, which ships inside bootstrap-5.2.0-beta1.zip and latest bootstrap-main.zip files contain that broken css as well.

Scss from 5.1.3 compiles proper css on the same setup.

Reduced test cases

Try to compile with minimal custom.scss file: @import "../node_modules/bootstrap/scss/bootstrap";

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome, Opera

What version of Bootstrap are you using?

5.2.0 beta 1, latest snapshot.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
ffooddcommented, Jun 17, 2022

Then those are bugs in IDE, linters and minifiers.

Nevertheless, those empty custom properties are useless and should be dropped to prevent confusion and save a few bytes.

1reaction
Kiriakkcommented, Jun 17, 2022

FWIW, this is valid CSS. 🤷

The only potential issue is the predictability regarding the behaviour, since every property will inherit and some won’t (but agai’, this is thé standard behaviour when you don’t provide any value).

Dropping them would decrease file size a little bit, but I’m not sure it’d be noticeable.

My biggest issue here is that compiled css is considered broken by my IDE due to the missing values and subsequent minify task is not being run because of this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using null in SCSS variables to avoid unnecessary output
Using null in SCSS variables to avoid unnecessary output. Here's a little CSS trick that can help with skinnable/themeable websites.
Read more >
SASS How to set a Variable to equal nothing? - Stack Overflow
Both will work for your example. The only advantage of null is that it disappears if you use it with a property. @mixin...
Read more >
What no one told you about CSS Variables
The empty value allows us to remove the var() declaration from a property! This can be useful when using var() within a complex...
Read more >
Property Declarations - Sass
Sometimes you only want a property declaration to show up some of the time. If a declaration's value is null or an empty...
Read more >
CSS Variables | SamanthaMing.com
Move over Sass, we have CSS variables now! Native CSS without any preprocessors and compiling...
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