Debian Codegraph @

man/as_sass.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/as_sass.R
3 \name{as_sass}
4 \alias{as_sass}
5 \title{Convert an R object into Sass code}
6 \usage{
7 as_sass(input)
8 }
9 \arguments{
10 \item{input}{Any of the following:
11 \itemize{
12 \item A character vector containing Sass code.
13 \item A named list containing variable names and values.
14 \item A \code{\link[=sass_file]{sass_file()}}, \code{\link[=sass_layer]{sass_layer()}}, and/or \code{\link[=sass_bundle]{sass_bundle()}}.
15 \item A \code{\link[=list]{list()}} containing any of the above.
16 }}
17 }
18 \value{
19 a single character value to be supplied to \code{\link[=sass]{sass()}}.
20 }
21 \description{
22 Converts multiple types of inputs to a single Sass input string for
23 \code{\link[=sass]{sass()}}.
24 }
25 \examples{
26 # Example of regular Sass input
27 as_sass("body { color: \"blue\"; }")
28
29 # There is support for adding variables
30 as_sass(
31 list(
32 list(color = "blue"),
33 "body { color: $color; }"
34 )
35 )
36
37 \donttest{
38 # Add a file name
39 someFile <- tempfile("variables")
40
41 # Overwrite color to red
42 write("$color: \"red\";", someFile)
43
44 input <-
45 as_sass(
46 list(
47 list(color = "blue"),
48 sass_file(someFile),
49 "body { color: $color; }"
50 )
51 )
52
53 input
54
55 # The final body color is red
56 sass(input)
57 }
58 }
59 \references{
60 \url{https://sass-lang.com/documentation/at-rules/import}
61 }