R: Get default sass cache object for the current context

sass_cache_get {sass} | R Documentation

## Get default sass cache object for the current context

### Description

Get the default sass cache object, for the current context. The context depends on factors described below.

`sass_cache_get()` first checks the `sass.cache` option. If it is set to `NULL` or `FALSE`, then this function returns `NULL`. If it has been set to a string, it is treated as a directory name, and this function returns a `sass_file_cache()` object using that directory. If the option has been set to a `sass_file_cache()` object, then it will return that object.

In most cases, this function uses the user's cache directory, by calling `tools::R_user_dir("sass", which = "cache")` (for R 4.0 and above) or `rappdirs::user_cache_dir("R-sass")` (for older versions of R).

If this function is called from a Shiny application, it will also look for a subdirectory named `app_cache/`. If it exists, it will use a directory named `app_cache/sass/` to store the cache.

When running a Shiny application in a typical R session, it will not create the `app_cache/` subdirectory, but it will use it if present. This scopes the cache to the application.

With Shiny applications hosted on Shiny Server and Connect, it will create a `app_cache/sass/` subdirectory, so that the cache is scoped to the application and will not interfere with another application's cache.

### Usage

    sass_cache_get()

### Shiny Developer Mode

If Shiny Developer Mode is enabled (by setting `options(shiny.devmode = TRUE)` or calling `shiny::devmode(TRUE)`, the default global option value for `sass.cache` is updated to `FALSE` instead of `TRUE`, similar to `getOption("sass.cache", FALSE)`. This setting allows developers to make sure what is being returned from `sass()` is not an incorrect cache result.

### See Also

`sass_cache_get_dir()`, `sass()`

[Package sass version 0.3.1 Index]