max
max

Reputation: 4521

How can I use the new bs4() theme in bookdown?

How can I use the bs4 theme in bookdown, such as the one used for the R4DS book

In the _output.yaml I see the following code, but it doesn't work with my project.

bookdown::bs4_book:
  theme:
    primary: "#637238"
  repo: https://github.com/hadley/r4ds
  includes:
    in_header: [ga_script.html]

and I get this error when I attempt to build the book

Error: 'bs4_book' is not an exported object from 'namespace:bookdown'
Execution halted

Upvotes: 15

Views: 2799

Answers (1)

max
max

Reputation: 4521

I got it to work by doing the following:

Run the following

remotes::install_github("rstudio/bslib")
install.packages("downlit")
remotes::install_github("rstudio/bookdown")

Change the _output.yaml to the following:

bookdown::bs4_book:
  theme:
    primary: "#637238"

Upvotes: 15

Related Questions