Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for bslib > 0.5.1 #2395

Merged
merged 13 commits into from
Apr 8, 2024
Merged

Updates for bslib > 0.5.1 #2395

merged 13 commits into from
Apr 8, 2024

Conversation

gadenbuie
Copy link
Contributor

@gadenbuie gadenbuie commented Feb 12, 2024

Background

This updates the logic around bslib-provided themes. Two major changes have happened in bslib:

  1. We've added a new "shiny" Bootstrap preset theme, which is now the default for bs_theme() without additional arguments.
  2. As a result, we have superseded bs_theme(bootswatch=) with bs_theme(preset=). For backwards compatibility, both arguments are treated equally but only one may be provided.

Changes

This PR updates pkgdown to adapt to the above:

  1. If no theme is requested, pkgdown will use preset = "default", restoring behavior prior to the new bs_theme() default (in bslib v0.6.0).

  2. I added support for template.bslib.preset in addition to (and in front of) template.bootswatch. This could also be named bs_preset or something else entirely if you want.

  3. I renamed get_bslib_theme() and check_bslib_theme() (previously (get,check)_bootswatch_) and I updated check_bslib_theme() to know about all built-in theme presets from bslib.

  4. I moved check_bslib_theme() into get_bslib_theme() so that the error message can report the checked template field but get_bslib_theme() can still return a string theme name.

  5. Finally, when a theme isn't in pkgdown's internal bootswatch_bg list, we now default to "light" to avoid throwing an error.

R/theme.R Outdated Show resolved Hide resolved
R/theme.R Outdated Show resolved Hide resolved
R/theme.R Show resolved Hide resolved
@hadley hadley added this to the 2.0.8 milestone Mar 11, 2024
@hadley hadley merged commit ab970fd into r-lib:main Apr 8, 2024
12 of 13 checks passed
@gadenbuie gadenbuie deleted the fix/bslib-font-deps branch April 22, 2024 13:47
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this pull request Jun 1, 2024
Including improved error messages and pass through to `bslib::bs_theme()`.

Fixes r-lib#2393. Fixes r-lib#2376.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unused fonts are bundled / distributed after bslib update bslib 0.6.0 changes default theme
2 participants