bslib
bslib copied to clipboard
Remove bs3compat's dependence on utility classes
It appears utility classes are responsible for about 1/2 of Bootstrap CSS:
bs_size <- function(x) {
bs <- bs_theme_dependencies(x)[[2]]
f <- file.path(bs$src, bs$stylesheet)
file.info(f)["size"]
}
bs_size(bs_theme())
#> bootstrap.min.css 227346
bs_theme() %>% bs_remove("_utilities") %>% bs_size()
#> Error: The target selector was not found.
#> Use "@extend .text-muted !optional" to avoid this error.
#> on line 2 of inst/bs3compat/_help_text.scss
#> >> @extend .form-text; @extend .text-muted;
#> ------------------------------^
bs_theme() %>% bs_remove(c("bs3compat", "_utilities")) %>% bs_size()
#> bootstrap.min.css 112914
More generally, seems we should favor Sass variables over @extend
in bs3compat so it's easier to bs_remove()
rules.
Actually, bs3compat itself is pretty heavy 😬
bs_theme() %>% bs_remove("bs3compat") %>% bs_size()
#> bootstrap.min.css 153618