I want to load a local bootstrap theme with bslib. Note: This continues a discussion on github. Essentially what I want to achieve is for a graphical designer to make our own custom Bootstrap theme and then load it.
It was suggested on github that I first package the files together with
library(sass) my_theme <- sass_layer( functions = sass_file("functions.scss"), defaults = sass_file("variables.scss"), mixins = sass_file("mixins.scss"), rules = sass_file("rules.scss"), )
Then you can add this custom theme to a bslib theme like so:
library(bslib) bs_bundle(bs_theme(), my_theme)
I have two follow-up questions:
- How do I set this custom theme in R Markdown? Do I call it explicitly in YAML options like:
theme: !expr bslib::bs_bundle(bslib::bs_theme(), get_my_theme())
- I want to copy the files from a Bootswatch theme (I'm on BS4 at the moment) and then start from there. However for a Bootswatch theme I do not find all the files you mention above: functions.scss, variables.scss, mixins.scss, rules.scss. For example, for BS4 "Flatly" I only find the following files: _bootswatch.scss, _variables.scss, font.css. Given the files found, how do I instantiate my own bs_theme using them?