Prevent `null` Sass variables from creating empty CSS variables
See original GitHub issuePrerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
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:
- Created a year ago
- Reactions:6
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.