Skip to content

Styling RCAP sites with CSS

Shane Porter edited this page Apr 5, 2017 · 1 revision

There are two supported methods to style an RCAP site.

  1. Package theme
  2. Asset theme

Package Theme

A package theme is a standard R package with a rcap-style.css file contained in the inst/www directory. The package name must be in the format rcloud.rcap.style.name, where name is the name of the package. Examples of this are rcloud.rcap.style.mycompany and rcloud.rcap.style.bigdata. Installed packages with this naming convention are picked up by the RCAP designer and the user can select them to be used in the site settings.

Asset Theme

RCAP also supports an asset based convention for styling, namely the rcap_designer.css RCloud asset. If a notebook has this asset, RCAP will use it to style the resulting website.

Rationale

If you're creating a number of RCAP sites, each with a consistent theme, then a Package theme is the way to go. Simply write your CSS in the R package, build and install, and select it as the theme for your sites. You then have a consistent visual style.

If you're wishing to tweak a few settings of the standard RCAP styling, then you may want to simply use the Asset Theme approach. Moreover, you may want to use a Package Theme and an Asset Theme. The Asset Theme is referenced after any Package Theme, so you can override Package Theme settings in your Asset Theme.

Note that Package Themes are available on a machine-wide basis (since they are installed R packages), but Asset Themes are associated with the notebook, so they are less portable.