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
rappdirs::user_cache_dir("R-sass")
.
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.
sass_cache_get()
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.