Learn R Programming

sass (version 0.2.0)

sass: Compile Sass to CSS

Description

Compile Sass to CSS using LibSass.

Usage

sass(
  input = NULL,
  options = sass_options(),
  output = NULL,
  cache_options = sass_cache_options(),
  write_attachments = NA
)

Arguments

input

Accepts raw Sass, a named list of variables, or a list of raw Sass and/or named variables. See as_sass and sass_import / sass_file for more details.

options

Compiler options for Sass. Please specify options using sass_options.

output

Specifies path to output file for compiled CSS.

cache_options

Caching options for Sass. Please specify options using sass_cache_options. Caching is turned off by default for interactive R sessions, and turned on for non-interactive ones.

write_attachments

If the input contains sass_layer objects that have file attachments, and output is not NULL, then copy the file attachments to the directory of output. (Defaults to NA, which merely emits a warning if file attachments are present, but does not write them to disk; the side-effect of writing extra files is subtle and potentially destructive, as files may be overwritten.)

Value

If output = NULL, the function returns a string value of the compiled CSS. If the output path is specified, the compiled CSS is written to that file and invisible() is returned.

See Also

http://sass-lang.com/guide

Examples

Run this code
# NOT RUN {
# raw Sass input
sass("foo { margin: 122px * .3; }")

# list of inputs, including named variables
sass(list(
  list(width = "122px"),
  "foo { margin: $width * .3; }"
))

# import a file
tmp_file <- tempfile()
writeLines("foo { margin: $width * .3; }", tmp_file)
sass(list(
  list(width = "122px"),
  sass_file(tmp_file)
))
# }

Run the code above in your browser using DataLab