rstudio / rstudio/bslib

Remove bs3compat's dependence on utility classes

Open
#165 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the bs_remove() examples and reading inst/bs3compat/_help_text.scss, where the reported @extend failure occurs. Inspect the other bs3compat Sass files for similar @extend usage and verify that removing utility rules succeeds without errors and produces the smaller stylesheet described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, scss
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.