output_template: An intelligent (temporary) output file

Description Usage Arguments Value Examples

View source: R/sass.R

Description

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.

Usage

1
output_template(basename = "sass", dirname = basename, fileext = NULL)

Arguments

basename

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

dirname

a non-empty character vector 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".

Value

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

Examples

1
2
3
4
sass("body {color: red}", output = output_template())

func <- output_template(basename = "foo", dirname = "bar-")
func(suffix = "baz")

sass documentation built on Jan. 25, 2021, 1:06 a.m.