Updated .bg-* and .text-* utilities break when CSS variables are not enabled in v5.1.0
See original GitHub issueIn one of my projects I include the needed Bootstrap SCSS files manually and specifically exclude bootstrap/scss/root
, first because I don’t rely on most of the CSS variables and secondly because adding all CSS variables increases the CSS file size by about 50-60kb (uncompressed).
With v5.1.0 all .bg-*
and .text-*
utilities break, as the needed CSS variables are missing, e.g.
.text-white {
--bs-text-opacity: 1;
color: rgba(var(--bs-white-rgb), var(--bs-text-opacity)) !important; // --bs-white-rgb is not set
}
Is there a simple way to disable CSS variables generation or to reduce the number of CSS variables? The only way forward right now would be to revert the utility sets back to $theme-colors
, but that still leaves an additional --bs-text-opacity: 1;
and does not take care of --bs-body-color
and the like:
$utilities-text-colors: $theme-colors;
$utilities-bg-colors: $theme-colors;
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:39 (16 by maintainers)
Top Results From Across the Web
Bootstrap Blog · Official blog for the Bootstrap framework.
Fixed broken .bg-body utility. This was caused by the same --body-rgb CSS variable for both text and background. --body-rgb is now split ......
Read more >Background · Boosted v5.1
1.0, background-color utilities are generated with Sass using CSS variables. This allows for real-time color changes without compilation and dynamic alpha ...
Read more >Breaking Change: CSS Variable Syntax - Sass
When they were parsed as SassScript values, syntax that would have been valid plain CSS failed to parse. For example, the Polymer library...
Read more >HTML Standard
In parallel with this, the W3C also worked on a new language that was not ... here by "␣") and line breaks ("⏎")...
Read more >var() - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The var() CSS function can be used to insert the value of a custom property (sometimes called a "CSS variable") instead of any...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
The whole bg-, text- update in 5.1.0 has seemingly complicated the entire process of adding a new theme-color. The only way I could find to get the bg- and text- classes regenerated for the new “custom” theme color is…
I discovered this on an SO question and here’s the working code demo
Whereas in 5.0.2 one could simply follow the example in the docs…
Thanks! This really needs to be written in the official documentation!