Intended for use with sass()'s output argument for temporary file generation that is cache and options aware. In particular, this ensures that new redundant file(s) aren't generated on a sass() cache hit, and that the file's extension is suitable for the sass_options()'s output_style.

output_template(
  basename = "sass",
  dirname = basename,
  fileext = NULL,
  path = tempdir()
)

Arguments

basename

a non-empty character string giving the outfile name (without the extension).

dirname

a non-empty character string giving the initial part of the directory name.

fileext

the output file extension. The default is ".min.css" for compressed and compact output styles; otherwise, its ".css".

path

the output file's root directory path.

Value

A function with two arguments: options and suffix. When called inside sass() with caching enabled, the caching key is supplied to suffix.

Examples

sass("body {color: red}", output = output_template())
#> [1] "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpyIBY91/sassfbb6fa246d7e54e6ae24e1d7b70bec4e/sass.css"
func <- output_template(basename = "foo", dirname = "bar-") func(suffix = "baz")
#> [1] "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpyIBY91/bar-baz/foo.css"