Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sass_cache_get

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

Syntactically Awesome Style Sheets ('Sass')

v0.3.1
MIT + file LICENSE
Authors
Joe Cheng [aut], Timothy Mastny [aut], Richard Iannone [aut] (<https://orcid.org/0000-0003-3925-190X>), Barret Schloerke [aut] (<https://orcid.org/0000-0001-9986-114X>), Carson Sievert [aut, cre] (<https://orcid.org/0000-0002-4958-2844>), RStudio [cph, fnd], Sass Open Source Foundation [ctb, cph] (LibSass library), Greter Marcel [ctb, cph] (LibSass library), Mifsud Michael [ctb, cph] (LibSass library), Hampton Catlin [ctb, cph] (LibSass library), Natalie Weizenbaum [ctb, cph] (LibSass library), Chris Eppstein [ctb, cph] (LibSass library), Adams Joseph [ctb, cph] (json.cpp), Trifunovic Nemanja [ctb, cph] (utf8.h)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.