r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
721 stars 336 forks source link

Add command to update theme without rebuilding pages #2806

Closed andrewmarx closed 3 weeks ago

andrewmarx commented 3 weeks ago

I'm in the process of trying to find a bootswatch theme I like, but it takes 15-20 minutes to build my site just to update the theme. For now, I've resorted to just manually downloading and swapping out the CSS file, but it could be convenient to have something like a rebuild_theme() command for more complicated configurations that doesn't go through the long process of rebuilding all the pages

jayhesselberth commented 3 weeks ago

You can use bslib to preview themes for over colors etc

https://rstudio.github.io/bslib/reference/bs_theme_preview.html

andrewmarx commented 3 weeks ago

That's a cool tool, but there are some discrepancies between it, my pkgdown build results, and the bootswatch website. For example, setting the Flatly theme in my pkgdown yaml gives a result similar to the bootswatch website, but the bslib preview navbar is a completely different color (seems to be the green text color Flatly uses when hovering over links).

But then, the Spacelab theme has the opposite problem; the bslib preview navbar seems to match the color in the theme website (but is missing the gradient), and my pkgdown build is giving me a gray navbar.

Cerulean in the bslib preview has a significantly darker blue navbar than expected and is also missing the gradient.

I don't know what's going on. I'm just trying to quickly set a bootswatch theme in my pkgdown yaml so I can move on to other more important things; nothing else. I am on the most recent versions of bslib and pkgdown.

jayhesselberth commented 3 weeks ago

You should also be able to preview the main page after pkgdown::build_home(), which will be fast (unless you have a complex README). So after making changes, you'd do

should only take a few seconds.

hadley commented 3 weeks ago

Or even just pkgdown::build_home_index(); that's what I use if I just want to quickly preview a new look.