Debian Codegraph @

man/sass_partial.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/sass.R
3 \name{sass_partial}
4 \alias{sass_partial}
5 \title{Compile rules against a Sass Bundle or Sass Layer object}
6 \usage{
7 sass_partial(
8 rules,
9 bundle,
10 options = sass_options_get(),
11 output = NULL,
12 write_attachments = NA,
13 cache = sass_cache_get(),
14 cache_key_extra = NULL
15 )
16 }
17 \arguments{
18 \item{rules}{A set of sass rules, which will be used instead of the rules
19 from \code{layer}.}
20
21 \item{bundle}{A \code{\link[=sass_bundle]{sass_bundle()}} or \code{\link[=sass_layer]{sass_layer()}} object.}
22
23 \item{options}{Compiler \code{\link[=sass_options]{sass_options()}}.}
24
25 \item{output}{Specifies path to output file for compiled CSS. May be a
26 character string or \code{\link[=output_template]{output_template()}}}
27
28 \item{write_attachments}{If the input contains \code{\link[=sass_layer]{sass_layer()}} objects that
29 have file attachments, and \code{output} is not \code{NULL}, then copy the file
30 attachments to the directory of \code{output}. (Defaults to \code{NA}, which merely
31 emits a warning if file attachments are present, but does not write them to
32 disk; the side-effect of writing extra files is subtle and potentially
33 destructive, as files may be overwritten.)}
34
35 \item{cache}{This can be a directory to use for the cache, a \link{FileCache}
36 object created by \code{\link[=sass_file_cache]{sass_file_cache()}}, or \code{FALSE} or \code{NULL} for no caching.}
37
38 \item{cache_key_extra}{additional information to considering when computing
39 the cache key. This should include any information that could possibly
40 influence the resulting CSS that isn't already captured by \code{input}. For
41 example, if \code{input} contains something like \code{"@import sass_file.scss"} you
42 may want to include the \code{\link[=file.mtime]{file.mtime()}} of \code{sass_file.scss} (or, perhaps, a
43 \code{\link[=packageVersion]{packageVersion()}} if \code{sass_file.scss} is bundled with an R package).}
44 }
45 \description{
46 Replaces the rules for a \code{\link[=sass_layer]{sass_layer()}} object with new rules, and compile it.
47 This is useful when (for example) you want to compile a set of rules using
48 variables derived from a theme, but you do not want the resulting CSS for the
49 entire theme -- just the CSS for the specific rules passed in.
50 }
51 \examples{
52 theme <- sass_layer(
53 defaults = sass_file(system.file("examples/variables.scss", package = "sass")),
54 rules = sass_file(system.file("examples/rules.scss", package = "sass"))
55 )
56
57 # Compile the theme
58 sass(theme)
59
60 # Sometimes we want to use the variables from the theme to compile other sass
61 my_rules <- ".someclass { background-color: $bg; color: $fg; }"
62 sass_partial(my_rules, theme)
63
64 }