A Bootstrap theme created with bs_theme()
is comprised of
many Sass layers.
bs_remove()
and bs_retrieve()
allow you to remove or retrieve an
individual layer, either to reduce the size of the compiled CSS or to extract
styles from a theme.
Arguments
- theme
A
bs_theme()
object.- ids
a character vector of ids
- include_unnamed
whether or not to include unnamed
sass::sass_layer()
s (e.g., Bootstrap Sass variables, functions, and mixins).
Value
Returns a modified bs_theme()
object.
See also
Other Bootstrap theme functions:
bs_add_variables()
,
bs_current_theme()
,
bs_dependency()
,
bs_global_theme()
,
bs_theme()
,
bs_theme_dependencies()
,
bs_theme_preview()
Examples
bs4 <- bs_theme(version = 4)
# Retrieve sass bundle for print styles
bs_retrieve(bs4, "_print", include_unnamed = FALSE)
#> /* Sass Bundle: _print */
#> @import "/home/runner/work/_temp/Library/bslib/lib/bs4/scss/_print.scss";
#> /* *** */
# Remove CSS rules for print and carousels
bs4_no_print <- bs_remove(bs4, c("_print", "_carousel"))
suppressWarnings(
bs_retrieve(bs4_no_print, "_print", include_unnamed = FALSE)
)
#> /* Sass Bundle: (empty) *** */
# Remove BS3 compatibility layer
bs4_no_compat <- bs_remove(bs4, "bs3compat")