bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Prevent `null` Sass variables from creating empty CSS variables

Open Kiriakk opened this issue 3 years ago • 10 comments

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.

Kiriakk avatar Jun 16 '22 20:06 Kiriakk

This isn't exactly broken, it's that the Sass variables are null and do not compile to anything. This works great in our normal property usage (Sass will remove the property: null line during compilation), but not so well with CSS variables. We may need to add a manual check for these things in the future.

#35442 aimed to try that out, but I wasn't too keen on the extra syntax on top of each instance.

mdo avatar Jun 16 '22 23:06 mdo

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 again, this is the 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.

ffoodd avatar Jun 17 '22 04:06 ffoodd

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.

Kiriakk avatar Jun 17 '22 08:06 Kiriakk

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.

ffoodd avatar Jun 17 '22 21:06 ffoodd

Hello When will this problem be solved?

rbsdotnet avatar Aug 27 '22 08:08 rbsdotnet

Hi Dear @julien-deramond When will this problem be solved?

rbsdotnet avatar Sep 10 '22 09:09 rbsdotnet

Hi Dear @julien-deramond

When will this problem be solved?

When the issue is closed, you'll know it's been addressed ;).

mdo avatar Sep 10 '22 17:09 mdo

Missing property values in the "(property) : (value)" declaration. Using compiled Bootstrap 5.2.3 in file bootstrap.css:

bootstrap.css -> Line: 4194	
bootstrap.css -> Line: 2807	
bootstrap.css -> Line: 3532	
bootstrap.css -> Line: 3646	
bootstrap.css -> Line: 3820	
bootstrap.css -> Line: 4199	
bootstrap.css -> Line: 4200	
bootstrap.css -> Line: 4201	
bootstrap.css -> Line: 4508	
bootstrap.css -> Line: 4509	
bootstrap.css -> Line: 5210	
bootstrap.css -> Line: 5277	
bootstrap.css -> Line: 5291	
bootstrap.css -> Line: 5569	
bootstrap.css -> Line: 5680	
bootstrap.css -> Line: 6096	

Yousha avatar Jan 01 '24 12:01 Yousha

This is still an issue in Bootstrap 5.3.2

I'm trying to use less and it is failing due to the value being empty.

tlsimmons88 avatar Jan 23 '24 20:01 tlsimmons88

Are there any updates or known fixes on this? I am also compiling Bootstrap 5.3.2 using LibSass and .nav-link breaks because --bs-nav-link-padding-y and --bs-nav-link-padding-x are not set

SilvanVerhoeven avatar Feb 14 '24 17:02 SilvanVerhoeven