Learn R Programming

sass

The sass R package provides bindings to LibSass, a fast Sass compiler written in C++. Sass is a mature and stable CSS extension language that makes styling modern websites less complex and more composable.

Installation

Install the released version of sass from CRAN:

install.packages("sass")

Install the latest development build from GitHub:

# install.packages("remotes")
remotes::install_github("rstudio/sass")

Basic usage

To compile Sass into CSS, provide Sass to the input argument of the sass() function. input can be any of the following:

  • An R string (as in the example below).
  • A named list() defining Sass variables.
  • A sass_file(), sass_import(), or sass_layer().
  • A nested list() comprising of all the above.
library(sass)
sass(input = "
  $size: 50%;
  foo { margin: $size * .33; }
")

Learn more

See sass’s overview vignette as well as the official Sass documentation.

Ask a question

If you have a question about sass, try asking one on https://forum.posit.co:

Copy Link

Version

Install

install.packages('sass')

Monthly Downloads

1,020,973

Version

0.4.10

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Carson Sievert

Last Published

April 11th, 2025

Functions in sass (0.4.10)

sass_import

Sass Import
sass_options

Compiler Options for Sass
sass_partial

Compile rules against a Sass Bundle or Sass Layer object
sass_cache_get

Retrieve the default file cache
FileCache

Create a file cache object
font_google

Helpers for importing web fonts
sass

Compile Sass to CSS
as_sass

Convert an R object into Sass code
sass_layer

Bundling Sass layers
output_template

An intelligent (temporary) output file
write_file_attachments

Write file attachments from a sass theme object
sass_cache_options

Caching Options for Sass (defunct)
sass-deprecated

Deprecated
as_sass_layer

Sass Bundle to Single Sass Layer
sass_cache_get_dir

Get and set the cache object registered for a specific directory
sass_file_cache

Create a file cache object
sass_cache_context_dir

Return the cache directory for the current context.